Programmability objects from database
Removed commented code Added fn_GetExpiredTECNByOriginator
This commit is contained in:
29
Programmability/Stored Procedures/AddUserToTrainingGroup.sql
Normal file
29
Programmability/Stored Procedures/AddUserToTrainingGroup.sql
Normal file
@ -0,0 +1,29 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[AddUserToTrainingGroup] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[AddUserToTrainingGroup] -- Add the parameters for the stored procedure here
|
||||
@GroupID INT,
|
||||
@UserID INT,
|
||||
@UserFullName VARCHAR(150) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
INSERT INTO
|
||||
TrainingGroupMembers (TrainingGroupID, UserID, FullName)
|
||||
VALUES
|
||||
(@GroupID, @UserID, @UserFullName)
|
||||
END
|
||||
GO
|
329
Programmability/Stored Procedures/AnalyzeLotAncestry.sql
Normal file
329
Programmability/Stored Procedures/AnalyzeLotAncestry.sql
Normal file
@ -0,0 +1,329 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[AnalyzeLotAncestry] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[AnalyzeLotAncestry] @LotNo varchar(20),
|
||||
@IncidentTime datetime = NULL,
|
||||
@LogIssueID int = NULL,
|
||||
@LogDocumentType int = NULL,
|
||||
@LogParms xml = NULL,
|
||||
@AnalysisType CHAR(1) = NULL AS BEGIN
|
||||
SET
|
||||
NOCOUNT ON DECLARE @RootLotNo varchar(20) = @LotNo DECLARE @IncidentLotNo varchar(20) = @LotNo IF @LotNo LIKE '%.%' BEGIN
|
||||
SET
|
||||
@RootLotNo = LEFT(@LotNo, CHARINDEX('.', @LotNo)) + '1'
|
||||
SET
|
||||
@IncidentLotNo = @LotNo
|
||||
END DECLARE @sql nvarchar(max) DECLARE @lots TABLE(LotNo varchar(20), Queried bit) DECLARE @results TABLE(
|
||||
[WT_RECORD_CODE] [varchar](2) NULL,
|
||||
[WT_LOT_NO] [varchar](10) NULL,
|
||||
[WT_ACTION_DATE] [varchar](14) NULL,
|
||||
[WT_LOT_1] [varchar](10) NULL,
|
||||
[WT_LOT_2] [varchar](10) NULL,
|
||||
[WT_LOT_3] [varchar](10) NULL,
|
||||
[WT_LOT__4] [varchar](10) NULL,
|
||||
[WT_LOT_5] [varchar](10) NULL
|
||||
) DECLARE @transaction TABLE(
|
||||
[WT_RECORD_CODE] [varchar](2) NULL,
|
||||
[WT_LOT_NO] [varchar](10) NULL,
|
||||
[WT_ACTION_DATE] [varchar](14) NULL,
|
||||
[WT_LOT_TARGET] [varchar](10) NULL
|
||||
) DECLARE @finalresults TABLE(
|
||||
[ID] [int] NOT NULL IDENTITY(1, 1),
|
||||
[ParentLotNo] [varchar](20) NOT NULL,
|
||||
[LotNo] [varchar](20) NOT NULL,
|
||||
[ActionTime] [datetime] NOT NULL,
|
||||
[ActionType] [varchar](2) NOT NULL,
|
||||
[IsAffected] bit NULL
|
||||
) --INSERT INTO @lots(LotNo, Queried) VALUES (@RootLotNo, 0)
|
||||
INSERT INTO
|
||||
@lots(LotNo, Queried)
|
||||
VALUES
|
||||
(@IncidentLotNo, 0) WHILE EXISTS (
|
||||
SELECT
|
||||
1
|
||||
FROM
|
||||
@lots
|
||||
WHERE
|
||||
Queried = 0
|
||||
) BEGIN
|
||||
SELECT
|
||||
TOP 1 @LotNo = LotNo
|
||||
FROM
|
||||
@lots
|
||||
WHERE
|
||||
Queried = 0
|
||||
SET
|
||||
@sql = FORMATMESSAGE(
|
||||
'SELECT * FROM OPENQUERY(FAB2SPN, ' + '''SELECT WT_RECORD_CODE, WT_LOT_NO, WT_ACTION_DATE, WT_LOT_1, WT_LOT_2, WT_LOT_3, WT_LOT__4, WT_LOT_5 ' + 'FROM WT_RECORD ' + 'WHERE WT_WP_DIRECT_KEY = ''''3002%s '''' AND WT_RECORD_CODE IN (''''SP'''',''''CB'''')'') ',
|
||||
@LotNo
|
||||
)
|
||||
DELETE FROM
|
||||
@results
|
||||
INSERT INTO
|
||||
@results EXEC sp_executesql @sql
|
||||
DELETE FROM
|
||||
@transaction
|
||||
INSERT INTO
|
||||
@transaction(
|
||||
[WT_RECORD_CODE],
|
||||
[WT_LOT_NO],
|
||||
[WT_ACTION_DATE],
|
||||
[WT_LOT_TARGET]
|
||||
)
|
||||
SELECT
|
||||
[WT_RECORD_CODE],
|
||||
[WT_LOT_NO],
|
||||
[WT_ACTION_DATE],
|
||||
[WT_LOT_TARGET]
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
[WT_RECORD_CODE],
|
||||
[WT_LOT_NO],
|
||||
[WT_ACTION_DATE],
|
||||
WT_LOT_1 AS [WT_LOT_TARGET]
|
||||
FROM
|
||||
@results
|
||||
UNION
|
||||
SELECT
|
||||
[WT_RECORD_CODE],
|
||||
[WT_LOT_NO],
|
||||
[WT_ACTION_DATE],
|
||||
WT_LOT_2 AS [WT_LOT_TARGET]
|
||||
FROM
|
||||
@results
|
||||
UNION
|
||||
SELECT
|
||||
[WT_RECORD_CODE],
|
||||
[WT_LOT_NO],
|
||||
[WT_ACTION_DATE],
|
||||
WT_LOT_3 AS [WT_LOT_TARGET]
|
||||
FROM
|
||||
@results
|
||||
UNION
|
||||
SELECT
|
||||
[WT_RECORD_CODE],
|
||||
[WT_LOT_NO],
|
||||
[WT_ACTION_DATE],
|
||||
WT_LOT__4 AS [WT_LOT_TARGET]
|
||||
FROM
|
||||
@results
|
||||
UNION
|
||||
SELECT
|
||||
[WT_RECORD_CODE],
|
||||
[WT_LOT_NO],
|
||||
[WT_ACTION_DATE],
|
||||
WT_LOT_5 AS [WT_LOT_TARGET]
|
||||
FROM
|
||||
@results
|
||||
) subtable
|
||||
WHERE
|
||||
[WT_LOT_TARGET] <> ''
|
||||
INSERT INTO
|
||||
@lots(LotNo, Queried)
|
||||
SELECT
|
||||
DISTINCT WT_LOT_TARGET,
|
||||
0
|
||||
FROM
|
||||
@transaction
|
||||
WHERE
|
||||
NOT EXISTS (
|
||||
SELECT
|
||||
1
|
||||
FROM
|
||||
@lots l
|
||||
WHERE
|
||||
l.LotNo = WT_LOT_TARGET
|
||||
)
|
||||
UPDATE
|
||||
@lots
|
||||
SET
|
||||
Queried = 1
|
||||
WHERE
|
||||
LotNo = @LotNo
|
||||
INSERT INTO
|
||||
@finalresults(
|
||||
[ParentLotNo],
|
||||
[LotNo],
|
||||
[ActionTime],
|
||||
[ActionType]
|
||||
)
|
||||
SELECT
|
||||
RTRIM(WT_LOT_NO),
|
||||
RTRIM(WT_LOT_TARGET),
|
||||
CONVERT(
|
||||
datetime,
|
||||
STUFF(
|
||||
STUFF(
|
||||
STUFF(
|
||||
STUFF(STUFF(WT_ACTION_DATE, 5, 0, '-'), 8, 0, '-'),
|
||||
11,
|
||||
0,
|
||||
' '
|
||||
),
|
||||
14,
|
||||
0,
|
||||
':'
|
||||
),
|
||||
17,
|
||||
0,
|
||||
':'
|
||||
),
|
||||
20
|
||||
),
|
||||
WT_RECORD_CODE
|
||||
FROM
|
||||
@transaction
|
||||
WHERE
|
||||
WT_RECORD_CODE = 'SP'
|
||||
INSERT INTO
|
||||
@finalresults(
|
||||
[ParentLotNo],
|
||||
[LotNo],
|
||||
[ActionTime],
|
||||
[ActionType]
|
||||
)
|
||||
SELECT
|
||||
RTRIM(WT_LOT_TARGET),
|
||||
RTRIM(WT_LOT_NO),
|
||||
CONVERT(
|
||||
datetime,
|
||||
STUFF(
|
||||
STUFF(
|
||||
STUFF(
|
||||
STUFF(STUFF(WT_ACTION_DATE, 5, 0, '-'), 8, 0, '-'),
|
||||
11,
|
||||
0,
|
||||
' '
|
||||
),
|
||||
14,
|
||||
0,
|
||||
':'
|
||||
),
|
||||
17,
|
||||
0,
|
||||
':'
|
||||
),
|
||||
20
|
||||
),
|
||||
WT_RECORD_CODE
|
||||
FROM
|
||||
@transaction
|
||||
WHERE
|
||||
WT_RECORD_CODE = 'CB'
|
||||
END;
|
||||
|
||||
WITH relevantresults as (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
@finalresults
|
||||
WHERE
|
||||
(ActionTime >= @IncidentTime)
|
||||
OR (@IncidentTime IS NULL)
|
||||
),
|
||||
affectedlots as (
|
||||
SELECT
|
||||
ID,
|
||||
ParentLotNo,
|
||||
LotNo,
|
||||
ActionTime
|
||||
FROM
|
||||
relevantresults
|
||||
WHERE
|
||||
ParentLotNo = @IncidentLotNo
|
||||
UNION
|
||||
ALL
|
||||
SELECT
|
||||
rr.ID,
|
||||
rr.ParentLotNo,
|
||||
rr.LotNo,
|
||||
rr.ActionTime
|
||||
FROM
|
||||
affectedlots
|
||||
INNER JOIN relevantresults rr ON rr.ParentLotNo = affectedlots.LotNo
|
||||
AND rr.ActionTime > affectedlots.ActionTime
|
||||
)
|
||||
UPDATE
|
||||
@finalresults
|
||||
SET
|
||||
IsAffected = 1
|
||||
WHERE
|
||||
ID IN (
|
||||
SELECT
|
||||
ID
|
||||
FROM
|
||||
affectedlots
|
||||
)
|
||||
UPDATE
|
||||
@finalresults
|
||||
SET
|
||||
IsAffected = 1
|
||||
WHERE
|
||||
LotNo = @IncidentLotNo
|
||||
INSERT INTO
|
||||
@finalresults(
|
||||
ParentLotNo,
|
||||
LotNo,
|
||||
ActionTime,
|
||||
ActionType,
|
||||
IsAffected
|
||||
)
|
||||
SELECT
|
||||
'',
|
||||
@IncidentLotNo,
|
||||
'01/01/2001',
|
||||
'',
|
||||
1
|
||||
WHERE
|
||||
NOT EXISTS (
|
||||
SELECT
|
||||
1
|
||||
FROM
|
||||
@finalresults
|
||||
WHERE
|
||||
LotNo = @IncidentLotNo
|
||||
AND IsAffected = 1
|
||||
)
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
@finalresults
|
||||
ORDER BY
|
||||
ActionTime IF @LogIssueID IS NOT NULL
|
||||
AND @LogDocumentType IS NOT NULL BEGIN
|
||||
INSERT INTO
|
||||
LotSplitAnalysisLog(
|
||||
[IssueID],
|
||||
[DocumentType],
|
||||
[LotNumber],
|
||||
AnalysisType,
|
||||
[AnalysisTime],
|
||||
[AnalysisData]
|
||||
)
|
||||
SELECT
|
||||
@LogIssueID,
|
||||
@LogDocumentType,
|
||||
@LotNo,
|
||||
@AnalysisType,
|
||||
GETDATE(),
|
||||
(
|
||||
SELECT
|
||||
@LogParms AS 'parms',
|
||||
(
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
@finalresults FOR XML PATH('results'),
|
||||
TYPE
|
||||
) FOR XML PATH('log')
|
||||
)
|
||||
END
|
||||
END
|
||||
GO
|
61
Programmability/Stored Procedures/CCAddPCRBAttendees.sql
Normal file
61
Programmability/Stored Procedures/CCAddPCRBAttendees.sql
Normal file
@ -0,0 +1,61 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCAddPCRBAttendees] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCAddPCRBAttendees] @PCRBID INT,
|
||||
@AttendeeID VARCHAR(300),
|
||||
@JobTitle VARCHAR(50),
|
||||
@Location VARCHAR(50) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
Declare @AttendeeName VARCHAR(200)
|
||||
SET
|
||||
@AttendeeName = CONCAT(
|
||||
(
|
||||
SELECT
|
||||
FirstName
|
||||
FROM
|
||||
Users
|
||||
WHERE
|
||||
UserID = @AttendeeID
|
||||
),
|
||||
' ',
|
||||
(
|
||||
SELECT
|
||||
LastName
|
||||
FROM
|
||||
Users
|
||||
WHERE
|
||||
UserID = @AttendeeID
|
||||
)
|
||||
) -- Insert statements for procedure here
|
||||
INSERT INTO
|
||||
CCPCRBAttendee (
|
||||
AttendeeName,
|
||||
PCRBID,
|
||||
AttendeeID,
|
||||
JobTitle,
|
||||
Location
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@AttendeeName,
|
||||
@PCRBID,
|
||||
@AttendeeID,
|
||||
@JobTitle,
|
||||
@Location
|
||||
)
|
||||
END
|
||||
GO
|
30
Programmability/Stored Procedures/CCCancelCC.sql
Normal file
30
Programmability/Stored Procedures/CCCancelCC.sql
Normal file
@ -0,0 +1,30 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCCancelCC] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCCancelCC] -- Add the parameters for the stored procedure here
|
||||
@PlanNumber INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
UPDATE
|
||||
CCChangeControl
|
||||
SET
|
||||
Status = 2,
|
||||
ClosedDate = GETDATE()
|
||||
WHERE
|
||||
PlanNumber = @PlanNumber
|
||||
END
|
||||
GO
|
30
Programmability/Stored Procedures/CCCompleteCC.sql
Normal file
30
Programmability/Stored Procedures/CCCompleteCC.sql
Normal file
@ -0,0 +1,30 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCCompleteCC] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCCompleteCC] -- Add the parameters for the stored procedure here
|
||||
@PlanNumber INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
UPDATE
|
||||
CCChangeControl
|
||||
SET
|
||||
Status = 1,
|
||||
ClosedDate = GETDATE()
|
||||
WHERE
|
||||
PlanNumber = @PlanNumber
|
||||
END
|
||||
GO
|
26
Programmability/Stored Procedures/CCDeleteCCAttachment.sql
Normal file
26
Programmability/Stored Procedures/CCDeleteCCAttachment.sql
Normal file
@ -0,0 +1,26 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCDeleteCCAttachment] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCDeleteCCAttachment] -- Add the parameters for the stored procedure here
|
||||
@ID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
DELETE CCAttachment
|
||||
WHERE
|
||||
ID = @ID
|
||||
END
|
||||
GO
|
@ -0,0 +1,25 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCDeleteDecisionSummary] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCDeleteDecisionSummary] @ID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
DELETE CCDecisionSummary
|
||||
WHERE
|
||||
ID = @ID
|
||||
END
|
||||
GO
|
24
Programmability/Stored Procedures/CCDeleteGenerations.sql
Normal file
24
Programmability/Stored Procedures/CCDeleteGenerations.sql
Normal file
@ -0,0 +1,24 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCDeleteGenerations] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCDeleteGenerations] @PlanNumber INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
DELETE CCGeneration
|
||||
WHERE
|
||||
PlanNumber = @PlanNumber
|
||||
END
|
||||
GO
|
24
Programmability/Stored Procedures/CCDeleteLogistics.sql
Normal file
24
Programmability/Stored Procedures/CCDeleteLogistics.sql
Normal file
@ -0,0 +1,24 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCDeleteLogistics] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCDeleteLogistics] @PlanNumber INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
DELETE CCLogistics
|
||||
WHERE
|
||||
PlanNumber = @PlanNumber
|
||||
END
|
||||
GO
|
@ -0,0 +1,27 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCDeleteMeetingActionItem] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCDeleteMeetingActionItem] @ID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
DELETE CCMeetingActionItem
|
||||
WHERE
|
||||
ID = @ID DELETE CCMeetingActionItemResponsible
|
||||
WHERE
|
||||
MeetingActionItemID = @ID
|
||||
END
|
||||
GO
|
@ -0,0 +1,25 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCDeleteMeetingAttachment] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCDeleteMeetingAttachment] @ID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
DELETE CCMeetingAttachment
|
||||
WHERE
|
||||
ID = @ID
|
||||
END
|
||||
GO
|
@ -0,0 +1,25 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCDeleteMeetingAttendee] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCDeleteMeetingAttendee] @ID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
DELETE CCMeetingAttendee
|
||||
WHERE
|
||||
ID = @ID
|
||||
END
|
||||
GO
|
@ -0,0 +1,24 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCDeleteMeetingPCRValues] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCDeleteMeetingPCRValues] @MeetingID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
DELETE CCMeetingPCRValue
|
||||
WHERE
|
||||
MeetingID = @MeetingID
|
||||
END
|
||||
GO
|
28
Programmability/Stored Procedures/CCDeletePCRBActionItem.sql
Normal file
28
Programmability/Stored Procedures/CCDeletePCRBActionItem.sql
Normal file
@ -0,0 +1,28 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCDeletePCRBActionItem] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCDeletePCRBActionItem] -- Add the parameters for the stored procedure here
|
||||
@ID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
DELETE CCPCRBActionItem
|
||||
WHERE
|
||||
ID = @ID DELETE CCPCRBActionItemResponsible
|
||||
WHERE
|
||||
PCRBActionItemID = @ID
|
||||
END
|
||||
GO
|
24
Programmability/Stored Procedures/CCDeletePartNumbers.sql
Normal file
24
Programmability/Stored Procedures/CCDeletePartNumbers.sql
Normal file
@ -0,0 +1,24 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCDeletePartNumbers] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCDeletePartNumbers] @PlanNumber INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
DELETE CCPartNumber
|
||||
WHERE
|
||||
PlanNumber = @PlanNumber
|
||||
END
|
||||
GO
|
24
Programmability/Stored Procedures/CCDeleteProcesses.sql
Normal file
24
Programmability/Stored Procedures/CCDeleteProcesses.sql
Normal file
@ -0,0 +1,24 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCDeleteProcesses] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCDeleteProcesses] @PlanNumber INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
DELETE CCProcess
|
||||
WHERE
|
||||
PlanNumber = @PlanNumber
|
||||
END
|
||||
GO
|
@ -0,0 +1,29 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetActionItemFileName] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetActionItemFileName] -- Add the parameters for the stored procedure here
|
||||
@FileGUID VARCHAR(50) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
SELECT
|
||||
[FileName]
|
||||
FROM
|
||||
CCMeetingActionItem
|
||||
WHERE
|
||||
FileGUID = @FileGUID
|
||||
END
|
||||
GO
|
@ -0,0 +1,31 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetActionItemResponsible] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetActionItemResponsible] -- Add the parameters for the stored procedure here
|
||||
AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
SELECT
|
||||
LTRIM(RTRIM(CONVERT(VARCHAR(10), UserID))) AS ResponsibleID,
|
||||
LTRIM(RTRIM(FirstName + ' ' + LastName)) AS ResponsibleName
|
||||
FROM
|
||||
Users
|
||||
ORDER BY
|
||||
FirstName,
|
||||
LastName
|
||||
END
|
||||
GO
|
36
Programmability/Stored Procedures/CCGetCCAttachments.sql
Normal file
36
Programmability/Stored Procedures/CCGetCCAttachments.sql
Normal file
@ -0,0 +1,36 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetCCAttachments] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetCCAttachments] @PlanNumber INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
SELECT
|
||||
DISTINCT A.*,
|
||||
U.FirstName + ' ' + U.LastName AS UploadedByName,
|
||||
SUBSTRING(
|
||||
FileName,
|
||||
PATINDEX('%.%', FileName) + 1,
|
||||
LEN(FileName)
|
||||
) AS FileExtension
|
||||
FROM
|
||||
CCChangeControl CC
|
||||
INNER JOIN CCAttachment A ON CC.PlanNumber = A.PlanNumber
|
||||
LEFT JOIN Users U ON A.UploadedByID = U.UserID
|
||||
WHERE
|
||||
CC.PlanNumber = @PlanNumber
|
||||
END
|
||||
GO
|
29
Programmability/Stored Procedures/CCGetCCFileName.sql
Normal file
29
Programmability/Stored Procedures/CCGetCCFileName.sql
Normal file
@ -0,0 +1,29 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetCCFileName] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetCCFileName] -- Add the parameters for the stored procedure here
|
||||
@FileGUID VARCHAR(50) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
SELECT
|
||||
[FileName]
|
||||
FROM
|
||||
CCAttachment
|
||||
WHERE
|
||||
FileGUID = @FileGUID
|
||||
END
|
||||
GO
|
110
Programmability/Stored Procedures/CCGetChangeControl.sql
Normal file
110
Programmability/Stored Procedures/CCGetChangeControl.sql
Normal file
@ -0,0 +1,110 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetChangeControl] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetChangeControl] -- Add the parameters for the stored procedure here
|
||||
@PlanNumber INT,
|
||||
@UserID INT,
|
||||
@CanViewITAR INT OUTPUT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
DECLARE @ITARRowCount INT IF NOT EXISTS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
CCChangeControl
|
||||
WHERE
|
||||
RecordLockIndicator = 1
|
||||
AND PlanNumber = @PlanNumber
|
||||
) BEGIN
|
||||
UPDATE
|
||||
CCChangeControl
|
||||
SET
|
||||
RecordLockIndicator = 1,
|
||||
RecordLockedBy = @UserID,
|
||||
RecordLockedDate = GETDATE(),
|
||||
LastUpdateDate = GETDATE()
|
||||
WHERE
|
||||
PlanNumber = @PlanNumber
|
||||
END
|
||||
SET
|
||||
@CanViewITAR = 1 IF EXISTS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
CCChangeControl
|
||||
WHERE
|
||||
PlanNumber = @PlanNumber
|
||||
AND IsITAR = 1
|
||||
) BEGIN
|
||||
SELECT
|
||||
@ITARRowCount = COUNT(*)
|
||||
FROM
|
||||
dbo.fnIsUserITARCompliant(@UserID) IF (@ITARRowCount > 0)
|
||||
SET
|
||||
@CanViewITAR = 1
|
||||
ELSE
|
||||
SET
|
||||
@CanViewITAR = 0
|
||||
END -- Insert statements for procedure here
|
||||
SELECT
|
||||
DISTINCT CC.*,
|
||||
U.FirstName + ' ' + U.LastName AS OwnerName,
|
||||
U1.FirstName + ' ' + U1.LastName AS RecordLockByName,
|
||||
(
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
CCMeeting
|
||||
WHERE
|
||||
Decision = -1
|
||||
AND CCMeeting.PlanNumber = @PlanNumber
|
||||
) AS MeetingExist,
|
||||
PCR1ID,
|
||||
PCR2ID,
|
||||
PCR3ID,
|
||||
--CAST('M-' + YEAR(InsertTimeStamp) + '-' + PlanYearlyIdentifier AS VARCHAR) AS PlanTitle,
|
||||
--CONCAT('M-', YEAR(CC.InsertTimeStamp), '-', CC.PlanYearlyIdentifier) AS PlanTitle,
|
||||
MesaPlanNo AS PlanTitle,
|
||||
CASE
|
||||
WHEN CC.ClosedDate IS NULL THEN 0
|
||||
ELSE 1
|
||||
END PCRBClosed
|
||||
FROM
|
||||
CCChangeControl CC
|
||||
INNER JOIN Users U ON CC.OwnerID = U.UserID
|
||||
LEFT JOIN Users U1 ON CC.RecordLockedBy = U1.UserID
|
||||
WHERE
|
||||
CC.PlanNumber = @PlanNumber
|
||||
SELECT
|
||||
GenerationID
|
||||
FROM
|
||||
CCGeneration
|
||||
WHERE
|
||||
PlanNumber = @PlanNumber
|
||||
SELECT
|
||||
LogisticsID
|
||||
FROM
|
||||
CCLogistics
|
||||
WHERE
|
||||
PlanNumber = @PlanNumber
|
||||
SELECT
|
||||
ProcessID
|
||||
FROM
|
||||
CCProcess
|
||||
WHERE
|
||||
PlanNumber = @PlanNumber
|
||||
END
|
||||
GO
|
186
Programmability/Stored Procedures/CCGetChangeControlList.sql
Normal file
186
Programmability/Stored Procedures/CCGetChangeControlList.sql
Normal file
@ -0,0 +1,186 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetChangeControlList] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetChangeControlList] -- Add the parameters for the stored procedure here
|
||||
@UserID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- UNLOCK all the CC records if there are any pending locks
|
||||
UPDATE
|
||||
CCChangeControl
|
||||
SEt
|
||||
RecordLocked = 0,
|
||||
RecordLockedBy = NULL,
|
||||
RecordLockedDate = NULL,
|
||||
RecordLockIndicator = 0
|
||||
WHERE
|
||||
RecordLockedBy = @UserID
|
||||
UPDATE
|
||||
CCMeeting
|
||||
SEt
|
||||
RecordLockedBy = NULL,
|
||||
RecordLockedDate = NULL,
|
||||
RecordLockIndicator = 0
|
||||
WHERE
|
||||
RecordLockedBy = @UserID -- Insert statements for procedure here
|
||||
SELECT
|
||||
DISTINCT C.PlanNumber AS IssueID,
|
||||
C.Title,
|
||||
U.FirstName + ' ' + U.LastName AS Owner,
|
||||
C.MesaPlanNo AS MesaIdTitle,
|
||||
CASE
|
||||
WHEN ChangeLevel = -1 THEN NULL
|
||||
ELSE ChangeLevel
|
||||
END AS ChangeLevel,
|
||||
Dates.StartDate,
|
||||
CASE
|
||||
WHEN [STATUS] = 1
|
||||
OR [STATUS] = 2 THEN ClosedDate
|
||||
ELSE Dates.StatusDate
|
||||
END AS StatusDate,
|
||||
CPCRB.PCRBStatus,
|
||||
CCGens.Generations,
|
||||
CCLogs.Logistics,
|
||||
CCProcess.Processes,
|
||||
C.ToolTypes,
|
||||
CASE
|
||||
WHEN [STATUS] = 1
|
||||
OR [STATUS] = 2 THEN ''
|
||||
ELSE MAI1.Responsibles
|
||||
END AS ActionItemResponsibility
|
||||
FROM
|
||||
CCChangeControl C
|
||||
LEFT JOIN CCMeeting M ON C.PlanNumber = M.PlanNumber
|
||||
LEFT JOIN Users U ON C.OwnerID = U.UserID
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
PlanNumber,
|
||||
MIN(MeetingDate) AS StartDate,
|
||||
MAX(MeetingDate) AS StatusDate
|
||||
FROM
|
||||
CCMeeting
|
||||
GROUP BY
|
||||
PlanNumber
|
||||
) AS Dates ON C.PlanNumber = Dates.PlanNumber -- Get Status
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
PlanNumber,
|
||||
CASE
|
||||
WHEN [STATUS] = 1 THEN 'Closed'
|
||||
WHEN [STATUS] = 2 THEN 'Cancelled'
|
||||
WHEN [STATUS] = 0 THEN (
|
||||
SELECT
|
||||
PCRValues
|
||||
FROM
|
||||
vCCMeetingPCRs P
|
||||
WHERE
|
||||
MeetingDate = (
|
||||
SELECT
|
||||
MAX(MeetingDate)
|
||||
FROM
|
||||
CCMeeting
|
||||
WHERE
|
||||
PlanNumber = C.PlanNumber
|
||||
)
|
||||
AND P.PlanNumber = C.PlanNumber
|
||||
)
|
||||
ELSE ''
|
||||
END AS PCRBStatus
|
||||
FROM
|
||||
CCChangeControl C
|
||||
) AS CPCRB ON C.PlanNumber = CPCRB.PlanNumber -- Concatenate Gens
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
DISTINCT CC.PlanNumber,
|
||||
STUFF (
|
||||
(
|
||||
SELECT
|
||||
', ' + LTRIM(RTRIM(CAST(Generation AS VARCHAR(50))))
|
||||
FROM
|
||||
CCGeneration CCG
|
||||
LEFT JOIN CCGenerationMaster GM ON CCG.GenerationID = GM.GenerationID
|
||||
WHERE
|
||||
CCG.PlanNumber = CC.PlanNumber FOR XML PATH('')
|
||||
),
|
||||
1,
|
||||
1,
|
||||
''
|
||||
) AS Generations
|
||||
FROM
|
||||
CCChangeControl CC
|
||||
) AS CCGens ON C.PlanNumber = CCGens.PlanNumber
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
DISTINCT CC.PlanNumber,
|
||||
STUFF (
|
||||
(
|
||||
SELECT
|
||||
', ' + LTRIM(RTRIM(CAST(Logistics AS VARCHAR(50))))
|
||||
FROM
|
||||
CCLogistics CCL
|
||||
LEFT JOIN CCLogisticsMaster LM ON CCL.LogisticsID = LM.LogisticsID
|
||||
WHERE
|
||||
CCL.PlanNumber = CC.PlanNumber FOR XML PATH('')
|
||||
),
|
||||
1,
|
||||
1,
|
||||
''
|
||||
) AS Logistics
|
||||
FROM
|
||||
CCChangeControl CC
|
||||
) AS CCLogs ON C.PlanNumber = CCLogs.PlanNumber -- Concatenate process
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
DISTINCT CC.PlanNumber,
|
||||
STUFF (
|
||||
(
|
||||
SELECT
|
||||
', ' + LTRIM(RTRIM(CAST(Process AS VARCHAR(50))))
|
||||
FROM
|
||||
CCProcess CCP
|
||||
LEFT JOIN CCProcessMaster PM ON CCP.ProcessID = PM.ProcessID
|
||||
WHERE
|
||||
CCP.PlanNumber = CC.PlanNumber FOR XML PATH('')
|
||||
),
|
||||
1,
|
||||
1,
|
||||
''
|
||||
) AS Processes
|
||||
FROM
|
||||
CCChangeControl CC
|
||||
) AS CCProcess ON C.PlanNumber = CCProcess.PlanNumber --Contcatenate Responsible person
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
DISTINCT CC.PlanNumber,
|
||||
STUFF (
|
||||
(
|
||||
SELECT
|
||||
DISTINCT ', ' + LTRIM(RTRIM(CAST(AIR.Responsibles AS VARCHAR(350))))
|
||||
FROM
|
||||
CCMeeting CM
|
||||
LEFT JOIN dbo.fn_GetMeetingAI_Responsibles_ByCC() AIR ON CM.MeetingID = AIR.MeetingID
|
||||
WHERE
|
||||
CM.PlanNumber = CC.PlanNumber FOR XML PATH('')
|
||||
),
|
||||
1,
|
||||
1,
|
||||
''
|
||||
) AS Responsibles
|
||||
FROM
|
||||
CCChangeControl CC
|
||||
) AS MAI1 ON C.PlanNumber = MAI1.PlanNumber
|
||||
END
|
||||
GO
|
75
Programmability/Stored Procedures/CCGetChangeControlRead.sql
Normal file
75
Programmability/Stored Procedures/CCGetChangeControlRead.sql
Normal file
@ -0,0 +1,75 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetChangeControlRead] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetChangeControlRead] -- Add the parameters for the stored procedure here
|
||||
@PlanNumber INT,
|
||||
@UserID INT,
|
||||
@CanViewITAR INT OUTPUT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
DECLARE @ITARRowCount INT
|
||||
SET
|
||||
@CanViewITAR = 1 IF EXISTS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
CCChangeControl
|
||||
WHERE
|
||||
PlanNumber = @PlanNumber
|
||||
AND IsITAR = 1
|
||||
) BEGIN
|
||||
SELECT
|
||||
@ITARRowCount = COUNT(*)
|
||||
FROM
|
||||
dbo.fnIsUserITARCompliant(@UserID) IF (@ITARRowCount > 0)
|
||||
SET
|
||||
@CanViewITAR = 1
|
||||
ELSE
|
||||
SET
|
||||
@CanViewITAR = 0
|
||||
END -- Insert statements for procedure here
|
||||
SELECT
|
||||
DISTINCT CC.*,
|
||||
U.FirstName + ' ' + U.LastName AS OwnerName,
|
||||
U1.FirstName + ' ' + U1.LastName AS RecordLockByName,
|
||||
--CONCAT('M-', YEAR(CC.InsertTimeStamp), '-', CC.PlanYearlyIdentifier) AS PlanTitle
|
||||
MesaPlanNo AS PlanTitle --REPLICATE('0',6-LEN(RTRIM(EmployeeId))) + RTRIM(EmployeeId)
|
||||
FROM
|
||||
CCChangeControl CC
|
||||
INNER JOIN Users U ON CC.OwnerID = U.UserID
|
||||
LEFT JOIN Users U1 ON CC.RecordLockedBy = U1.UserID
|
||||
WHERE
|
||||
CC.PlanNumber = @PlanNumber
|
||||
SELECT
|
||||
GenerationID
|
||||
FROM
|
||||
CCGeneration
|
||||
WHERE
|
||||
PlanNumber = @PlanNumber
|
||||
SELECT
|
||||
LogisticsID
|
||||
FROM
|
||||
CCLogistics
|
||||
WHERE
|
||||
PlanNumber = @PlanNumber
|
||||
SELECT
|
||||
ProcessID
|
||||
FROM
|
||||
CCProcess
|
||||
WHERE
|
||||
PlanNumber = @PlanNumber
|
||||
END
|
||||
GO
|
28
Programmability/Stored Procedures/CCGetChangeControls.sql
Normal file
28
Programmability/Stored Procedures/CCGetChangeControls.sql
Normal file
@ -0,0 +1,28 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetChangeControls] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetChangeControls] AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
dbo.fn_GetChangeControl()
|
||||
ORDER BY
|
||||
DocumentType,
|
||||
IssueID DESC
|
||||
END
|
||||
GO
|
@ -0,0 +1,29 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetDecisionsSummaryList] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetDecisionsSummaryList] -- Add the parameters for the stored procedure here
|
||||
@MeetingID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
CCDecisionSummary
|
||||
WHERE
|
||||
MeetingID = @MeetingID
|
||||
END
|
||||
GO
|
29
Programmability/Stored Procedures/CCGetGenerations.sql
Normal file
29
Programmability/Stored Procedures/CCGetGenerations.sql
Normal file
@ -0,0 +1,29 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetGenerations] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetGenerations] AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
SELECT
|
||||
DISTINCT GenerationID,
|
||||
Generation
|
||||
FROM
|
||||
CCGenerationMaster
|
||||
ORDER BY
|
||||
Generation
|
||||
END
|
||||
GO
|
29
Programmability/Stored Procedures/CCGetLogistics.sql
Normal file
29
Programmability/Stored Procedures/CCGetLogistics.sql
Normal file
@ -0,0 +1,29 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetLogistics] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetLogistics] AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
SELECT
|
||||
DISTINCT LogisticsID,
|
||||
Logistics
|
||||
FROM
|
||||
CCLogisticsMaster
|
||||
ORDER BY
|
||||
Logistics
|
||||
END
|
||||
GO
|
93
Programmability/Stored Procedures/CCGetMeeting.sql
Normal file
93
Programmability/Stored Procedures/CCGetMeeting.sql
Normal file
@ -0,0 +1,93 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetMeeting] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetMeeting] -- Add the parameters for the stored procedure here
|
||||
@MeetingID INT,
|
||||
@UserID INT,
|
||||
@CanViewITAR INT OUTPUT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
DECLARE @ITARRowCount INT IF NOT EXISTS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
CCMeeting
|
||||
WHERE
|
||||
RecordLockIndicator = 1
|
||||
AND MeetingDate = @MeetingID
|
||||
) BEGIN
|
||||
UPDATE
|
||||
CCMeeting
|
||||
SET
|
||||
RecordLockIndicator = 1,
|
||||
RecordLockedBy = @UserID,
|
||||
RecordLockedDate = GETDATE(),
|
||||
LastUpdateDate = GETDATE()
|
||||
WHERE
|
||||
MeetingID = @MeetingID
|
||||
END
|
||||
SET
|
||||
@CanViewITAR = 1 IF EXISTS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
CCMeeting M
|
||||
INNER JOIN CCChangeControl C ON M.PlanNumber = C.PlanNumber
|
||||
WHERE
|
||||
MeetingID = @MeetingID
|
||||
AND C.IsITAR = 1
|
||||
) BEGIN
|
||||
SELECT
|
||||
@ITARRowCount = COUNT(*)
|
||||
FROM
|
||||
dbo.fnIsUserITARCompliant(@UserID) IF (@ITARRowCount > 0)
|
||||
SET
|
||||
@CanViewITAR = 1
|
||||
ELSE
|
||||
SET
|
||||
@CanViewITAR = 0
|
||||
END -- Insert statements for procedure here
|
||||
SELECT
|
||||
M.MeetingID,
|
||||
ISNULL(LTRIM(RTRIM(M.PCRB)), 'Select') PCRB,
|
||||
M.MeetingDate,
|
||||
M.Decision,
|
||||
M.Notes,
|
||||
C.ChangeLevel,
|
||||
C.Title,
|
||||
C.PlanNumber,
|
||||
C.CurrentStep,
|
||||
M.RecordLockedBy,
|
||||
M.RecordLockIndicator,
|
||||
U1.FirstName + ' ' + U1.LastName AS RecordLockByName,
|
||||
CASE
|
||||
WHEN C.ClosedDate IS NULL THEN 0
|
||||
ELSE 1
|
||||
END PCRBClosed
|
||||
FROM
|
||||
CCMeeting M
|
||||
INNER JOIN CCChangeControl C ON M.PlanNumber = C.PlanNumber
|
||||
LEFT JOIN Users U1 ON M.RecordLockedBy = U1.UserID
|
||||
WHERE
|
||||
MeetingID = @MeetingID
|
||||
SELECT
|
||||
PCRValue AS PCRValueID
|
||||
FROM
|
||||
CCMeetingPCRValue
|
||||
WHERE
|
||||
MeetingID = @MeetingID
|
||||
END
|
||||
GO
|
@ -0,0 +1,82 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetMeetingActionItems] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetMeetingActionItems] @MeetingID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
SELECT
|
||||
AI.ID,
|
||||
AI.MeetingID,
|
||||
ActionItemname,
|
||||
CCResponsibles.Responsibles ResponsiblePerson,
|
||||
CCResponsiblesID.ResponsiblesID ResponsibleID,
|
||||
CASE
|
||||
WHEN Gating = 1 THEN 'Yes'
|
||||
ELSE 'No'
|
||||
END AS Gating,
|
||||
DueDate
|
||||
FROM
|
||||
CCMeetingActionItem AI
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
DISTINCT AI.ID,
|
||||
STUFF (
|
||||
(
|
||||
SELECT
|
||||
',' + LTRIM(
|
||||
RTRIM(
|
||||
CAST(U.FirstName + ' ' + U.LastName AS VARCHAR(350))
|
||||
)
|
||||
)
|
||||
FROM
|
||||
CCMeetingActionItemResponsible AIR
|
||||
INNER JOIN Users U ON AIR.ActionItemResponsible = U.UserID
|
||||
WHERE
|
||||
AI.ID = AIR.MeetingActionItemID FOR XML PATH('')
|
||||
),
|
||||
1,
|
||||
1,
|
||||
''
|
||||
) AS Responsibles
|
||||
FROM
|
||||
CCMeetingActionItem AI
|
||||
) AS CCResponsibles ON AI.ID = CCResponsibles.ID
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
DISTINCT AI.ID,
|
||||
STUFF (
|
||||
(
|
||||
SELECT
|
||||
',' + LTRIM(
|
||||
RTRIM(CAST(AIR.ActionItemResponsible AS VARCHAR(350)))
|
||||
)
|
||||
FROM
|
||||
CCMeetingActionItemResponsible AIR
|
||||
WHERE
|
||||
AI.ID = AIR.MeetingActionItemID FOR XML PATH('')
|
||||
),
|
||||
1,
|
||||
1,
|
||||
''
|
||||
) AS ResponsiblesID
|
||||
FROM
|
||||
CCMeetingActionItem AI
|
||||
) AS CCResponsiblesID ON AI.ID = CCResponsiblesID.ID
|
||||
WHERE
|
||||
AI.MeetingID = @MeetingID
|
||||
END
|
||||
GO
|
@ -0,0 +1,71 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetMeetingActionItems_All] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetMeetingActionItems_All] @PlanNumber INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
SELECT
|
||||
MA.ID,
|
||||
M.MeetingID,
|
||||
P.PCRValues AS PCRB,
|
||||
ActionItemname,
|
||||
CCResponsibles.Responsibles ResponsiblePerson,
|
||||
CASE
|
||||
WHEN Gating = 1 THEN 'Yes'
|
||||
ELSE 'No'
|
||||
END AS Gating,
|
||||
DueDate,
|
||||
Updates,
|
||||
ClosedStatus,
|
||||
MA.ClosedDate,
|
||||
FileGUID,
|
||||
FileName,
|
||||
UploadedByID,
|
||||
U.FirstName + ' ' + U.LastName AS UploadedByName
|
||||
FROM
|
||||
CCMeetingActionItem MA
|
||||
INNER JOIN CCMeeting M ON MA.MeetingID = M.MeetingID
|
||||
LEFT JOIN Users U ON MA.UploadedByID = U.UserID
|
||||
LEFT JOIN vCCMeetingPCRs P ON M.MeetingID = P.MeetingID
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
DISTINCT AI.ID,
|
||||
STUFF (
|
||||
(
|
||||
SELECT
|
||||
', ' + LTRIM(
|
||||
RTRIM(
|
||||
CAST(U.FirstName + ' ' + U.LastName AS VARCHAR(550))
|
||||
)
|
||||
)
|
||||
FROM
|
||||
CCMeetingActionItemResponsible AIR
|
||||
INNER JOIN Users U ON AIR.ActionItemResponsible = U.UserID
|
||||
WHERE
|
||||
AI.ID = AIR.MeetingActionItemID FOR XML PATH('')
|
||||
),
|
||||
1,
|
||||
1,
|
||||
''
|
||||
) AS Responsibles
|
||||
FROM
|
||||
CCMeetingActionItem AI
|
||||
) AS CCResponsibles ON MA.ID = CCResponsibles.ID
|
||||
WHERE
|
||||
M.PlanNumber = @PlanNumber
|
||||
END
|
||||
GO
|
@ -0,0 +1,36 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetMeetingAttachments] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetMeetingAttachments] @MeetingID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
SELECT
|
||||
DISTINCT A.*,
|
||||
U.FirstName + ' ' + U.LastName AS UploadedByName,
|
||||
SUBSTRING(
|
||||
FileName,
|
||||
PATINDEX('%.%', FileName) + 1,
|
||||
LEN(FileName)
|
||||
) AS FileExtension
|
||||
FROM
|
||||
CCMeeting M
|
||||
INNER JOIN CCMeetingAttachment A ON M.MeetingID = A.MeetingID
|
||||
LEFT JOIN Users U ON A.UploadedByID = U.UserID
|
||||
WHERE
|
||||
M.MeetingID = @MeetingID
|
||||
END
|
||||
GO
|
28
Programmability/Stored Procedures/CCGetMeetingAttendees.sql
Normal file
28
Programmability/Stored Procedures/CCGetMeetingAttendees.sql
Normal file
@ -0,0 +1,28 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetMeetingAttendees] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetMeetingAttendees] @MeetingID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
CCMeetingAttendee
|
||||
WHERE
|
||||
MeetingID = @MeetingID
|
||||
END
|
||||
GO
|
@ -0,0 +1,94 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetMeetingDecisionSummaryList] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetMeetingDecisionSummaryList] -- Add the parameters for the stored procedure here
|
||||
@PlanNumber INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
/****** Script for SelectTopNRows command from SSMS ******/
|
||||
SELECT
|
||||
DISTINCT P.PCRValues AS PCRB,
|
||||
M.MeetingDate,
|
||||
CCDecisionNotes.DecisionNotes,
|
||||
CCECNLink.ECNs AS ECNLinks,
|
||||
CCLDLink.LDs AS LotDispoLinks
|
||||
FROM
|
||||
CCChangeControl C
|
||||
INNER JOIN CCMeeting M ON C.PlanNumber = M.PlanNumber
|
||||
LEFT JOIN vCCMeetingPCRs P ON M.MeetingID = P.MeetingID
|
||||
LEFT JOIN CCDecisionSummary D ON M.MeetingID = D.MeetingID
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
DISTINCT MM.MeetingID,
|
||||
STUFF (
|
||||
(
|
||||
SELECT
|
||||
'~' + LTRIM(RTRIM(CAST(DecisionNotes AS VARCHAR(500))))
|
||||
FROM
|
||||
CCDecisionSummary CCD
|
||||
WHERE
|
||||
CCD.MeetingID = MM.MeetingID FOR XML PATH('')
|
||||
),
|
||||
1,
|
||||
1,
|
||||
''
|
||||
) AS DecisionNotes
|
||||
FROM
|
||||
CCMeeting MM
|
||||
) AS CCDecisionNotes ON M.MeetingID = CCDecisionNotes.MeetingID
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
DISTINCT MM.MeetingID,
|
||||
STUFF (
|
||||
(
|
||||
SELECT
|
||||
'~ ' + LTRIM(RTRIM(CAST(ECNLinks AS VARCHAR(100))))
|
||||
FROM
|
||||
CCDecisionSummary CCD
|
||||
WHERE
|
||||
CCD.MeetingID = MM.MeetingID FOR XML PATH('')
|
||||
),
|
||||
1,
|
||||
1,
|
||||
''
|
||||
) AS ECNs
|
||||
FROM
|
||||
CCMeeting MM
|
||||
) AS CCECNLink ON M.MeetingID = CCECNLink.MeetingID
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
DISTINCT MM.MeetingID,
|
||||
STUFF (
|
||||
(
|
||||
SELECT
|
||||
'~ ' + LTRIM(RTRIM(CAST(LotDispoLinks AS VARCHAR(100))))
|
||||
FROM
|
||||
CCDecisionSummary CCD
|
||||
WHERE
|
||||
CCD.MeetingID = MM.MeetingID FOR XML PATH('')
|
||||
),
|
||||
1,
|
||||
1,
|
||||
''
|
||||
) AS LDs
|
||||
FROM
|
||||
CCMeeting MM
|
||||
) AS CCLDLink ON M.MeetingID = CCLDLink.MeetingID
|
||||
WHERE
|
||||
C.PlanNumber = @PlanNumber
|
||||
END
|
||||
GO
|
29
Programmability/Stored Procedures/CCGetMeetingFileName.sql
Normal file
29
Programmability/Stored Procedures/CCGetMeetingFileName.sql
Normal file
@ -0,0 +1,29 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetMeetingFileName] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetMeetingFileName] -- Add the parameters for the stored procedure here
|
||||
@FileGUID VARCHAR(50) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
SELECT
|
||||
[FileName]
|
||||
FROM
|
||||
CCMeetingAttachment
|
||||
WHERE
|
||||
FileGUID = @FileGUID
|
||||
END
|
||||
GO
|
34
Programmability/Stored Procedures/CCGetMeetingList.sql
Normal file
34
Programmability/Stored Procedures/CCGetMeetingList.sql
Normal file
@ -0,0 +1,34 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetMeetingList] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetMeetingList] -- Add the parameters for the stored procedure here
|
||||
@PlanNumber INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
CCMeeting
|
||||
WHERE
|
||||
PlanNumber = @PlanNumber
|
||||
SELECT
|
||||
PCRValue AS PCRValueID
|
||||
FROM
|
||||
CCMeetingPCRValue
|
||||
WHERE
|
||||
MeetingID = @PlanNumber
|
||||
END
|
||||
GO
|
75
Programmability/Stored Procedures/CCGetMeetingRead.sql
Normal file
75
Programmability/Stored Procedures/CCGetMeetingRead.sql
Normal file
@ -0,0 +1,75 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetMeetingRead] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetMeetingRead] -- Add the parameters for the stored procedure here
|
||||
@MeetingID INT,
|
||||
@UserID INT,
|
||||
@CanViewITAR INT OUTPUT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
DECLARE @ITARRowCount INT
|
||||
SET
|
||||
@CanViewITAR = 1 IF EXISTS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
CCMeeting M
|
||||
INNER JOIN CCChangeControl C ON M.PlanNumber = C.PlanNumber
|
||||
WHERE
|
||||
MeetingID = @MeetingID
|
||||
AND C.IsITAR = 1
|
||||
) BEGIN
|
||||
SELECT
|
||||
@ITARRowCount = COUNT(*)
|
||||
FROM
|
||||
dbo.fnIsUserITARCompliant(@UserID) IF (@ITARRowCount > 0)
|
||||
SET
|
||||
@CanViewITAR = 1
|
||||
ELSE
|
||||
SET
|
||||
@CanViewITAR = 0
|
||||
END -- Insert statements for procedure here
|
||||
SELECT
|
||||
M.MeetingID,
|
||||
LTRIM(RTRIM(M.PCRB)) AS PCRB,
|
||||
M.MeetingDate,
|
||||
M.Decision,
|
||||
M.Notes,
|
||||
C.ChangeLevel,
|
||||
C.Title,
|
||||
C.PlanNumber,
|
||||
C.CurrentStep,
|
||||
M.RecordLockedBy,
|
||||
M.RecordLockIndicator,
|
||||
U1.FirstName + ' ' + U1.LastName AS RecordLockByName,
|
||||
CASE
|
||||
WHEN C.ClosedDate IS NULL THEN 0
|
||||
ELSE 1
|
||||
END PCRBClosed
|
||||
FROM
|
||||
CCMeeting M
|
||||
INNER JOIN CCChangeControl C ON M.PlanNumber = C.PlanNumber
|
||||
LEFT JOIN Users U1 ON M.RecordLockedBy = U1.UserID
|
||||
WHERE
|
||||
MeetingID = @MeetingID
|
||||
SELECT
|
||||
PCRValue AS PCRValueID
|
||||
FROM
|
||||
CCMeetingPCRValue
|
||||
WHERE
|
||||
MeetingID = @MeetingID
|
||||
END
|
||||
GO
|
36
Programmability/Stored Procedures/CCGetPCRB.sql
Normal file
36
Programmability/Stored Procedures/CCGetPCRB.sql
Normal file
@ -0,0 +1,36 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetPCRB] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetPCRB] -- Add the parameters for the stored procedure here
|
||||
@PlanNumber INT,
|
||||
@PCRB VARCHAR(10) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
SELECT
|
||||
PCRBID,
|
||||
PlanNumber,
|
||||
PCRB,
|
||||
Date,
|
||||
Decision,
|
||||
Notes
|
||||
FROM
|
||||
CCPCRB
|
||||
WHERE
|
||||
PlanNumber = @PlanNumber
|
||||
AND @PCRB = PCRB
|
||||
END
|
||||
GO
|
82
Programmability/Stored Procedures/CCGetPCRBActionItems.sql
Normal file
82
Programmability/Stored Procedures/CCGetPCRBActionItems.sql
Normal file
@ -0,0 +1,82 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetPCRBActionItems] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetPCRBActionItems] @PCRBID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
SELECT
|
||||
AI.ID,
|
||||
AI.PCRBID,
|
||||
ActionItemname,
|
||||
CCResponsibles.Responsibles ResponsiblePerson,
|
||||
CCResponsiblesID.ResponsiblesID ResponsibleID,
|
||||
CASE
|
||||
WHEN Gating = 1 THEN 'Yes'
|
||||
ELSE 'No'
|
||||
END AS Gating,
|
||||
DueDate
|
||||
FROM
|
||||
CCPCRBActionItem AI
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
DISTINCT AI.ID,
|
||||
STUFF (
|
||||
(
|
||||
SELECT
|
||||
',' + LTRIM(
|
||||
RTRIM(
|
||||
CAST(U.FirstName + ' ' + U.LastName AS VARCHAR(350))
|
||||
)
|
||||
)
|
||||
FROM
|
||||
CCPCRBActionItemResponsible AIR
|
||||
INNER JOIN Users U ON AIR.ActionItemResponsible = U.UserID
|
||||
WHERE
|
||||
AI.ID = AIR.PCRBActionItemID FOR XML PATH('')
|
||||
),
|
||||
1,
|
||||
1,
|
||||
''
|
||||
) AS Responsibles
|
||||
FROM
|
||||
CCPCRBActionItem AI
|
||||
) AS CCResponsibles ON AI.ID = CCResponsibles.ID
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
DISTINCT AI.ID,
|
||||
STUFF (
|
||||
(
|
||||
SELECT
|
||||
',' + LTRIM(
|
||||
RTRIM(CAST(AIR.ActionItemResponsible AS VARCHAR(350)))
|
||||
)
|
||||
FROM
|
||||
CCMeetingActionItemResponsible AIR
|
||||
WHERE
|
||||
AI.ID = AIR.MeetingActionItemID FOR XML PATH('')
|
||||
),
|
||||
1,
|
||||
1,
|
||||
''
|
||||
) AS ResponsiblesID
|
||||
FROM
|
||||
CCMeetingActionItem AI
|
||||
) AS CCResponsiblesID ON AI.ID = CCResponsiblesID.ID
|
||||
WHERE
|
||||
AI.PCRBID = @PCRBID
|
||||
END
|
||||
GO
|
28
Programmability/Stored Procedures/CCGetPCRBAttendees.sql
Normal file
28
Programmability/Stored Procedures/CCGetPCRBAttendees.sql
Normal file
@ -0,0 +1,28 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetPCRBAttendees] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetPCRBAttendees] @PCRBID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
CCPCRBAttendee
|
||||
WHERE
|
||||
PCRBID = @PCRBID
|
||||
END
|
||||
GO
|
30
Programmability/Stored Procedures/CCGetPCRValues.sql
Normal file
30
Programmability/Stored Procedures/CCGetPCRValues.sql
Normal file
@ -0,0 +1,30 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetPCRValues] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetPCRValues] -- Add the parameters for the stored procedure here
|
||||
AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
SELECT
|
||||
PCRValue AS PCRValueID,
|
||||
PCRValue AS PCRValueName
|
||||
FROM
|
||||
CCPCRValues
|
||||
ORDER BY
|
||||
PCRValue
|
||||
END
|
||||
GO
|
29
Programmability/Stored Procedures/CCGetPartNumbers.sql
Normal file
29
Programmability/Stored Procedures/CCGetPartNumbers.sql
Normal file
@ -0,0 +1,29 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetPartNumbers] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetPartNumbers] AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
SELECT
|
||||
DISTINCT PartNumberID,
|
||||
PartNumber
|
||||
FROM
|
||||
CCPartNumberMaster
|
||||
ORDER BY
|
||||
PartNumber
|
||||
END
|
||||
GO
|
29
Programmability/Stored Procedures/CCGetProcesses.sql
Normal file
29
Programmability/Stored Procedures/CCGetProcesses.sql
Normal file
@ -0,0 +1,29 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetProcesses] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetProcesses] AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
SELECT
|
||||
DISTINCT ProcessID,
|
||||
Process
|
||||
FROM
|
||||
CCProcessMaster
|
||||
ORDER BY
|
||||
Process
|
||||
END
|
||||
GO
|
251
Programmability/Stored Procedures/CCGetReport.sql
Normal file
251
Programmability/Stored Procedures/CCGetReport.sql
Normal file
@ -0,0 +1,251 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetReport] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[CCGetReport] @PlanNumber varchar(50) = NULL,
|
||||
@OwnerID int = NULL,
|
||||
@Title varchar(100) = NULL,
|
||||
@ChangeLevel int = NULL,
|
||||
@PCRValue varchar(50) = NULL,
|
||||
@GenerationIDs varchar(max) = NULL,
|
||||
@Tool varchar(100) = NULL,
|
||||
@ProcessIDs varchar(max) = NULL,
|
||||
@StartDateFrom date = NULL,
|
||||
@StartDateTo date = NULL,
|
||||
@ClosedDateFrom date = NULL,
|
||||
@ClosedDateTo date = NULL,
|
||||
@LatestMeetingDateFrom date = NULL,
|
||||
@LatestMeetingDateTo date = NULL,
|
||||
@BaseURL varchar(100) = NULL,
|
||||
@Username varchar(100) = '' AS BEGIN
|
||||
SET
|
||||
XACT_ABORT ON
|
||||
INSERT INTO
|
||||
ReportLog([ProcName], [Username], [Parms])
|
||||
SELECT
|
||||
OBJECT_NAME(@ @PROCID),
|
||||
@Username,
|
||||
(
|
||||
SELECT
|
||||
@PlanNumber AS PlanNumber,
|
||||
@OwnerID AS OwnerID,
|
||||
@Title AS Title,
|
||||
@ChangeLevel AS ChangeLevel,
|
||||
@PCRValue AS PCRValue,
|
||||
@GenerationIDs AS GenerationIDs,
|
||||
@Tool AS Tool,
|
||||
@ProcessIDs AS ProcessIDs,
|
||||
@StartDateFrom AS StartDateFrom,
|
||||
@StartDateTo AS StartDateTo,
|
||||
@ClosedDateFrom AS ClosedDateFrom,
|
||||
@ClosedDateTo AS ClosedDateTo,
|
||||
@LatestMeetingDateFrom AS LatestMeetingDateFrom,
|
||||
@LatestMeetingDateTo AS LatestMeetingDateTo,
|
||||
@BaseURL AS BaseURL FOR XML PATH
|
||||
)
|
||||
SELECT
|
||||
dbo.fnPlanConvertPlanNoToDisplayFormat(C.PlanNumber) AS PlanNumber,
|
||||
Dates.StartDate,
|
||||
U.FirstName + ' ' + U.LastName AS [Owner],
|
||||
C.Title,
|
||||
CASE
|
||||
WHEN ChangeLevel = -1 THEN NULL
|
||||
ELSE ChangeLevel
|
||||
END AS ChangeLevel,
|
||||
CASE
|
||||
WHEN [STATUS] = 1 THEN 'Closed'
|
||||
WHEN [STATUS] = 2 THEN 'Cancelled'
|
||||
WHEN [STATUS] = 0 THEN STUFF(
|
||||
(
|
||||
SELECT
|
||||
', ' + LTRIM(RTRIM(CAST(PCRValue AS VARCHAR(50))))
|
||||
FROM
|
||||
CCMeetingPCRValue P
|
||||
WHERE
|
||||
P.MeetingID = LatestMeeting.MeetingID
|
||||
ORDER BY
|
||||
1 FOR XML PATH('')
|
||||
),
|
||||
1,
|
||||
2,
|
||||
''
|
||||
)
|
||||
ELSE ''
|
||||
END AS PCRBStatus,
|
||||
LatestMeeting.MeetingDate AS LatestMeetingDate,
|
||||
CASE
|
||||
WHEN LatestMeeting.Decision = 1 THEN 'Approved'
|
||||
WHEN LatestMeeting.Decision = 0 THEN 'Not-Approved'
|
||||
ELSE 'Open'
|
||||
END AS LatestMeetingDecision,
|
||||
LatestMeeting.DecisionNotes AS LatestMeetingDecisionNotes,
|
||||
STUFF(
|
||||
(
|
||||
SELECT
|
||||
', ' + LTRIM(RTRIM(CAST(Generation AS VARCHAR(50))))
|
||||
FROM
|
||||
CCGeneration CCG
|
||||
LEFT JOIN CCGenerationMaster GM ON CCG.GenerationID = GM.GenerationID
|
||||
WHERE
|
||||
CCG.PlanNumber = C.PlanNumber FOR XML PATH('')
|
||||
),
|
||||
1,
|
||||
2,
|
||||
''
|
||||
) AS Generations,
|
||||
C.ToolTypes,
|
||||
STUFF(
|
||||
(
|
||||
SELECT
|
||||
', ' + LTRIM(RTRIM(CAST(Process AS VARCHAR(50))))
|
||||
FROM
|
||||
CCProcess CCP
|
||||
LEFT JOIN CCProcessMaster PM ON CCP.ProcessID = PM.ProcessID
|
||||
WHERE
|
||||
CCP.PlanNumber = C.PlanNumber FOR XML PATH('')
|
||||
),
|
||||
1,
|
||||
2,
|
||||
''
|
||||
) AS Processes,
|
||||
C.ChangeDescription,
|
||||
C.ReasonForChange,
|
||||
ClosedDate,
|
||||
@BaseURL + '/ChangeControl/Edit?IssueID=' + CONVERT(varchar(10), C.PlanNumber) AS [URL]
|
||||
FROM
|
||||
CCChangeControl C
|
||||
LEFT JOIN Users U ON C.OwnerID = U.UserID
|
||||
OUTER APPLY (
|
||||
SELECT
|
||||
MIN(MeetingDate) AS StartDate,
|
||||
MAX(MeetingDate) AS StatusDate
|
||||
FROM
|
||||
CCMeeting
|
||||
WHERE
|
||||
CCMeeting.PlanNumber = C.PlanNumber
|
||||
GROUP BY
|
||||
PlanNumber
|
||||
) AS Dates
|
||||
OUTER APPLY (
|
||||
SELECT
|
||||
TOP 1 CCMeeting.*,
|
||||
CCDecisionSummary.DecisionNotes
|
||||
FROM
|
||||
CCMeeting
|
||||
LEFT OUTER JOIN CCDecisionSummary ON CCDecisionSummary.MeetingID = CCMeeting.MeetingID
|
||||
WHERE
|
||||
CCMeeting.PlanNumber = C.PlanNumber
|
||||
ORDER BY
|
||||
MeetingDate DESC
|
||||
) AS LatestMeeting
|
||||
WHERE
|
||||
(
|
||||
@PlanNumber IS NULL
|
||||
OR dbo.fnPlanConvertPlanNoToDisplayFormat(C.PlanNumber) LIKE '%' + @PlanNumber + '%'
|
||||
)
|
||||
AND (
|
||||
ISNULL(@OwnerID, -1) = -1
|
||||
OR C.OwnerID = @OwnerID
|
||||
)
|
||||
AND (
|
||||
ISNULL(@Title, '') = ''
|
||||
OR C.Title LIKE '%' + @Title + '%'
|
||||
)
|
||||
AND (
|
||||
ISNULL(@ChangeLevel, -1) = -1
|
||||
OR C.ChangeLevel = @ChangeLevel
|
||||
)
|
||||
AND (
|
||||
ISNULL(@PCRValue, '') = ''
|
||||
OR (
|
||||
@PCRValue = 'Closed'
|
||||
AND [Status] = 1
|
||||
)
|
||||
OR (
|
||||
@PCRValue = 'Cancelled'
|
||||
AND [Status] = 2
|
||||
)
|
||||
OR (
|
||||
[Status] = 0
|
||||
AND EXISTS (
|
||||
SELECT
|
||||
1
|
||||
FROM
|
||||
CCMeetingPCRValue P
|
||||
WHERE
|
||||
P.MeetingID = LatestMeeting.MeetingID
|
||||
AND P.PCRValue = @PCRValue
|
||||
)
|
||||
)
|
||||
)
|
||||
AND (
|
||||
ISNULL(@GenerationIDs, '') = ''
|
||||
OR EXISTS (
|
||||
SELECT
|
||||
1
|
||||
FROM
|
||||
CCGeneration CCG
|
||||
WHERE
|
||||
CCG.PlanNumber = C.PlanNumber
|
||||
AND CCG.GenerationID IN (
|
||||
SELECT
|
||||
Val
|
||||
FROM
|
||||
dbo.fnSplitCSV(@GenerationIDs)
|
||||
)
|
||||
)
|
||||
)
|
||||
AND (
|
||||
ISNULL(@Tool, '') = ''
|
||||
OR C.ToolTypes LIKE '%' + @Tool + '%'
|
||||
)
|
||||
AND (
|
||||
ISNULL(@ProcessIDs, '') = ''
|
||||
OR EXISTS (
|
||||
SELECT
|
||||
1
|
||||
FROM
|
||||
CCProcess CCP
|
||||
WHERE
|
||||
CCP.PlanNumber = C.PlanNumber
|
||||
AND CCP.ProcessID IN (
|
||||
SELECT
|
||||
Val
|
||||
FROM
|
||||
dbo.fnSplitCSV(@ProcessIDs)
|
||||
)
|
||||
)
|
||||
)
|
||||
AND (
|
||||
@StartDateFrom IS NULL
|
||||
OR @StartDateFrom <= CONVERT(date, Dates.StartDate)
|
||||
)
|
||||
AND (
|
||||
@StartDateTo IS NULL
|
||||
OR CONVERT(date, Dates.StartDate) <= @StartDateTo
|
||||
)
|
||||
AND (
|
||||
@ClosedDateFrom IS NULL
|
||||
OR @ClosedDateFrom <= CONVERT(date, ClosedDate)
|
||||
)
|
||||
AND (
|
||||
@ClosedDateTo IS NULL
|
||||
OR CONVERT(date, ClosedDate) <= @ClosedDateTo
|
||||
)
|
||||
AND (
|
||||
@LatestMeetingDateFrom IS NULL
|
||||
OR @LatestMeetingDateFrom <= CONVERT(date, LatestMeeting.MeetingDate)
|
||||
)
|
||||
AND (
|
||||
@LatestMeetingDateTo IS NULL
|
||||
OR CONVERT(date, LatestMeeting.MeetingDate) <= @LatestMeetingDateTo
|
||||
)
|
||||
ORDER BY
|
||||
C.PlanNumber
|
||||
END
|
||||
GO
|
30
Programmability/Stored Procedures/CCGetSites.sql
Normal file
30
Programmability/Stored Procedures/CCGetSites.sql
Normal file
@ -0,0 +1,30 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetSites] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetSites] -- Add the parameters for the stored procedure here
|
||||
AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
SELECT
|
||||
SiteName AS SiteID,
|
||||
SiteName
|
||||
FROM
|
||||
CCSite
|
||||
ORDER BY
|
||||
SiteName
|
||||
END
|
||||
GO
|
29
Programmability/Stored Procedures/CCGetToolTypes.sql
Normal file
29
Programmability/Stored Procedures/CCGetToolTypes.sql
Normal file
@ -0,0 +1,29 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetToolTypes] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetToolTypes] AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
SELECT
|
||||
DISTINCT ToolTypeID,
|
||||
ToolType
|
||||
FROM
|
||||
CCToolTypeMaster
|
||||
ORDER BY
|
||||
ToolType
|
||||
END
|
||||
GO
|
31
Programmability/Stored Procedures/CCGetUsers.sql
Normal file
31
Programmability/Stored Procedures/CCGetUsers.sql
Normal file
@ -0,0 +1,31 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCGetUsers] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCGetUsers] -- Add the parameters for the stored procedure here
|
||||
AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
SELECT
|
||||
UserID AS AttendeeID,
|
||||
FirstName + ' ' + LastName AS AttendeeName
|
||||
FROM
|
||||
Users
|
||||
ORDER BY
|
||||
FirstName,
|
||||
LastName
|
||||
END
|
||||
GO
|
31
Programmability/Stored Procedures/CCInsertCCAttachment.sql
Normal file
31
Programmability/Stored Procedures/CCInsertCCAttachment.sql
Normal file
@ -0,0 +1,31 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCInsertCCAttachment] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCInsertCCAttachment] @ID INT OUT,
|
||||
@PlanNumber INT,
|
||||
@Title VARCHAR(100) = '',
|
||||
@RequirementsNotes VARCHAR(500) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
INSERT INTO
|
||||
CCAttachment (PlanNumber, Title, RequirementsNotes)
|
||||
VALUES
|
||||
(@PlanNumber, @Title, @RequirementsNotes)
|
||||
SET
|
||||
@ID = SCOPE_IDENTITY()
|
||||
END
|
||||
GO
|
138
Programmability/Stored Procedures/CCInsertChangeControl.sql
Normal file
138
Programmability/Stored Procedures/CCInsertChangeControl.sql
Normal file
@ -0,0 +1,138 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCInsertChangeControl] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCInsertChangeControl] -- Add the parameters for the stored procedure here
|
||||
@OwnerID INT,
|
||||
@PlanNumber INT OUT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
BEGIN DECLARE @CurrentYear INT DECLARE @CurrentYearlyIdentifier INT DECLARE @NextYearlyIdentifier INT DECLARE @MesaPlanNo VARCHAR(20)
|
||||
SET
|
||||
@CurrentYear = YEAR(GETDATE()) IF EXISTS (
|
||||
Select
|
||||
*
|
||||
FROM
|
||||
CCCurrentSequence
|
||||
WHERE
|
||||
year = @CurrentYear
|
||||
) BEGIN
|
||||
SET
|
||||
@CurrentYearlyIdentifier = (
|
||||
SELECT
|
||||
currentSequence
|
||||
FROM
|
||||
CCCurrentSequence
|
||||
WHERE
|
||||
year = @CurrentYear
|
||||
) + 1
|
||||
UPDATE
|
||||
CCCurrentSequence
|
||||
SET
|
||||
currentSequence = @CurrentYearlyIdentifier
|
||||
WHERE
|
||||
year = @CurrentYear
|
||||
END
|
||||
ELSE BEGIN
|
||||
SET
|
||||
@CurrentYearlyIdentifier = 1
|
||||
INSERT INTO
|
||||
CCCurrentSequence (year, currentSequence)
|
||||
VALUES
|
||||
(@CurrentYear, @CurrentYearlyIdentifier)
|
||||
END
|
||||
END
|
||||
SET
|
||||
@MesaPlanNo = CONCAT(
|
||||
'M-',
|
||||
@CurrentYear,
|
||||
'-',
|
||||
REPLICATE('0', 4 - LEN(RTRIM(@CurrentYearlyIdentifier))) + RTRIM(@CurrentYearlyIdentifier)
|
||||
)
|
||||
INSERT INTO
|
||||
CCChangeControl (OwnerID, PlanYearlyIdentifier, MesaPlanNo)
|
||||
VALUES
|
||||
(@OwnerID, @CurrentYearlyIdentifier, @MesaPlanNo)
|
||||
SET
|
||||
@PlanNumber = CAST(SCOPE_IDENTITY() AS INT)
|
||||
INSERT INTO
|
||||
CCAttachment (PlanNumber, Title, RequirementsNotes)
|
||||
SELECT
|
||||
@PlanNumber,
|
||||
CCAttachmentTitle,
|
||||
CCAttachmentRequirementNotes
|
||||
FROM
|
||||
CCAttachmentDefaults -- Add the three PCRB's automatically
|
||||
-- PCR 1
|
||||
INSERT INTO
|
||||
CCPCRB (PlanNumber, PCRB)
|
||||
VALUES
|
||||
(@PlanNumber, 'PCR1')
|
||||
UPDATE
|
||||
CCChangeControl
|
||||
set
|
||||
PCR1ID = CAST(SCOPE_IDENTITY() AS INT)
|
||||
WHERE
|
||||
PlanNumber = @PlanNumber
|
||||
INSERT INTO
|
||||
CCPCRBAttendee (PCRBID, AttendeeName, JobTitle, Location)
|
||||
SELECT
|
||||
CAST(SCOPE_IDENTITY() AS INT),
|
||||
AttendeeName,
|
||||
PCRBAttendeeJobTtile,
|
||||
Location
|
||||
FROM
|
||||
CCPCRBAttendeeJobTitle
|
||||
INSERT INTO
|
||||
CCPCRB (PlanNumber, PCRB)
|
||||
VALUES
|
||||
(@PlanNumber, 'PCR2')
|
||||
UPDATE
|
||||
CCChangeControl
|
||||
set
|
||||
PCR2ID = CAST(SCOPE_IDENTITY() AS INT)
|
||||
WHERE
|
||||
PlanNumber = @PlanNumber
|
||||
INSERT INTO
|
||||
CCPCRBAttendee (PCRBID, AttendeeName, JobTitle, Location)
|
||||
SELECT
|
||||
CAST(SCOPE_IDENTITY() AS INT),
|
||||
AttendeeName,
|
||||
PCRBAttendeeJobTtile,
|
||||
Location
|
||||
FROM
|
||||
CCPCRBAttendeeJobTitle
|
||||
INSERT INTO
|
||||
CCPCRB (PlanNumber, PCRB)
|
||||
VALUES
|
||||
(@PlanNumber, 'PCR3')
|
||||
UPDATE
|
||||
CCChangeControl
|
||||
set
|
||||
PCR3ID = CAST(SCOPE_IDENTITY() AS INT)
|
||||
WHERE
|
||||
PlanNumber = @PlanNumber
|
||||
INSERT INTO
|
||||
CCPCRBAttendee (PCRBID, AttendeeName, JobTitle, Location)
|
||||
SELECT
|
||||
CAST(SCOPE_IDENTITY() AS INT),
|
||||
AttendeeName,
|
||||
PCRBAttendeeJobTtile,
|
||||
Location
|
||||
FROM
|
||||
CCPCRBAttendeeJobTitle
|
||||
END
|
||||
GO
|
@ -0,0 +1,30 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCInsertDecisionSummary] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCInsertDecisionSummary] @ID INT OUT,
|
||||
@MeetingID INT,
|
||||
@DecisionNotes VARCHAR(2000) = '' AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
INSERT INTO
|
||||
CCDecisionSummary (MeetingID, DecisionNotes)
|
||||
VALUES
|
||||
(@MeetingID, @DecisionNotes)
|
||||
SET
|
||||
@ID = SCOPE_IDENTITY()
|
||||
END
|
||||
GO
|
28
Programmability/Stored Procedures/CCInsertGeneration.sql
Normal file
28
Programmability/Stored Procedures/CCInsertGeneration.sql
Normal file
@ -0,0 +1,28 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCInsertGeneration] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCInsertGeneration] -- Add the parameters for the stored procedure here
|
||||
@PlanNumber INT,
|
||||
@GenerationID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
INSERT INTO
|
||||
CCGeneration (PlanNumber, GenerationID)
|
||||
VALUES
|
||||
(@PlanNumber, @GenerationID)
|
||||
END
|
||||
GO
|
28
Programmability/Stored Procedures/CCInsertLogistics.sql
Normal file
28
Programmability/Stored Procedures/CCInsertLogistics.sql
Normal file
@ -0,0 +1,28 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCInsertLogistics] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCInsertLogistics] -- Add the parameters for the stored procedure here
|
||||
@PlanNumber INT,
|
||||
@LogisticsID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
INSERT INTO
|
||||
CCLogistics (PlanNumber, LogisticsID)
|
||||
VALUES
|
||||
(@PlanNumber, @LogisticsID)
|
||||
END
|
||||
GO
|
43
Programmability/Stored Procedures/CCInsertMeeting.sql
Normal file
43
Programmability/Stored Procedures/CCInsertMeeting.sql
Normal file
@ -0,0 +1,43 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCInsertMeeting] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCInsertMeeting] -- Add the parameters for the stored procedure here
|
||||
@PlanNumber INT,
|
||||
@MeetingID INT OUTPUT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
INSERT INTO
|
||||
CCMeeting (PlanNumber)
|
||||
VALUES
|
||||
(@PlanNumber)
|
||||
SET
|
||||
@MeetingID = SCOPE_IDENTITY()
|
||||
INSERT INTO
|
||||
CCMeetingAttendee (MeetingID, AttendeeName, JobTitle, Location)
|
||||
SELECT
|
||||
@MeetingID,
|
||||
AttendeeName,
|
||||
MeetingAttendeeJobTtile,
|
||||
Location
|
||||
FROM
|
||||
CCMeetingAttendeeJobTitle
|
||||
INSERT INTO
|
||||
CCMeetingAttachment (MeetingID, Title)
|
||||
VALUES
|
||||
(@MeetingID, 'Meeting Presentation (Required)')
|
||||
END
|
||||
GO
|
@ -0,0 +1,56 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCInsertMeetingActionItem] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCInsertMeetingActionItem] @MeetingID INT,
|
||||
@ActionItemName VARCHAR(100),
|
||||
@ResponsibleID Varchar(100),
|
||||
@Gating BIT,
|
||||
@DueDate DATETIME AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
INSERT INTO
|
||||
CCMeetingActionItem (MeetingID, ActionItemName, Gating, DueDate)
|
||||
VALUES
|
||||
(@MeetingID, @ActionItemName, @Gating, @DueDate) DECLARE @MeetingActionItemID INT
|
||||
SET
|
||||
@MeetingActionItemID = SCOPE_IDENTITY() DECLARE @SEPERATOR as VARCHAR(1) DECLARE @SP INT DECLARE @VALUE VARCHAR(1000)
|
||||
SET
|
||||
@SEPERATOR = ',' CREATE TABLE #tempTab (ActionItemResponsible int not null)
|
||||
WHILE PATINDEX('%' + @SEPERATOR + '%', @ResponsibleID) <> 0 BEGIN
|
||||
SELECT
|
||||
@SP = PATINDEX('%' + @SEPERATOR + '%', @ResponsibleID)
|
||||
SELECT
|
||||
@VALUE = LEFT(@ResponsibleID, @SP - 1)
|
||||
SELECT
|
||||
@ResponsibleID = STUFF(@ResponsibleID, 1, @SP, '')
|
||||
INSERT INTO
|
||||
#tempTab (ActionItemResponsible) VALUES (@VALUE)
|
||||
END
|
||||
DELETE FROM
|
||||
CCMeetingActionItemResponsible
|
||||
WHERE
|
||||
MeetingActionItemID = @MeetingActionItemID
|
||||
INSERT INTO
|
||||
CCMeetingActionItemResponsible
|
||||
SELECT
|
||||
@MeetingActionItemID,
|
||||
ActionItemResponsible
|
||||
FROM
|
||||
#tempTab
|
||||
DROP TABLE #tempTab
|
||||
END
|
||||
GO
|
@ -0,0 +1,30 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCInsertMeetingAttachmentAttrib] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCInsertMeetingAttachmentAttrib] @ID INT OUT,
|
||||
@MeetingID INT,
|
||||
@Title VARCHAR(100) = '' AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
INSERT INTO
|
||||
CCMeetingAttachment (MeetingID, Title)
|
||||
VALUES
|
||||
(@MeetingID, @Title)
|
||||
SET
|
||||
@ID = SCOPE_IDENTITY()
|
||||
END
|
||||
GO
|
@ -0,0 +1,61 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCInsertMeetingAttendee] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCInsertMeetingAttendee] @MeetingID INT,
|
||||
@AttendeeID VARCHAR(300),
|
||||
@JobTitle VARCHAR(50),
|
||||
@Location VARCHAR(50) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
Declare @AttendeeName VARCHAR(200)
|
||||
SET
|
||||
@AttendeeName = CONCAT(
|
||||
(
|
||||
SELECT
|
||||
FirstName
|
||||
FROM
|
||||
Users
|
||||
WHERE
|
||||
UserID = @AttendeeID
|
||||
),
|
||||
' ',
|
||||
(
|
||||
SELECT
|
||||
LastName
|
||||
FROM
|
||||
Users
|
||||
WHERE
|
||||
UserID = @AttendeeID
|
||||
)
|
||||
) -- Insert statements for procedure here
|
||||
INSERT INTO
|
||||
CCMeetingAttendee (
|
||||
AttendeeName,
|
||||
MeetingID,
|
||||
AttendeeUserID,
|
||||
JobTitle,
|
||||
Location
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@AttendeeName,
|
||||
@MeetingID,
|
||||
@AttendeeID,
|
||||
@JobTitle,
|
||||
@Location
|
||||
)
|
||||
END
|
||||
GO
|
@ -0,0 +1,28 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCInsertMeetingPCRValues] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCInsertMeetingPCRValues] -- Add the parameters for the stored procedure here
|
||||
@MeetingID INT,
|
||||
@PCRValue NCHAR(10) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
INSERT INTO
|
||||
CCMeetingPCRValue (MeetingID, PCRValue)
|
||||
VALUES
|
||||
(@MeetingID, @PCRValue)
|
||||
END
|
||||
GO
|
@ -0,0 +1,29 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCInsertNewMeetingAttendee] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCInsertNewMeetingAttendee] @MeetingId INT,
|
||||
@AttendeeName VARCHAR(300),
|
||||
@JobTitle VARCHAR(300),
|
||||
@Site VARCHAR(50) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
INSERT INTO
|
||||
[dbo].[CCMeetingAttendee] (MeetingID, AttendeeName, JobTitle, Location)
|
||||
VALUES
|
||||
(@MeetingId, @AttendeeName, @JobTitle, @Site)
|
||||
END
|
||||
GO
|
57
Programmability/Stored Procedures/CCInsertPCRBActionItem.sql
Normal file
57
Programmability/Stored Procedures/CCInsertPCRBActionItem.sql
Normal file
@ -0,0 +1,57 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCInsertPCRBActionItem] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCInsertPCRBActionItem] -- Add the parameters for the stored procedure here
|
||||
@PCRBID INT,
|
||||
@ActionItemName VARCHAR(100),
|
||||
@ResponsibleID Varchar(100),
|
||||
@Gating BIT,
|
||||
@DueDate DATETIME AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
INSERT INTO
|
||||
CCPCRBActionItem (PCRBID, ActionItemName, Gating, DueDate)
|
||||
VALUES
|
||||
(@PCRBID, @ActionItemName, @Gating, @DueDate) DECLARE @PCRBActionItemID INT
|
||||
SET
|
||||
@PCRBActionItemID = SCOPE_IDENTITY() DECLARE @SEPERATOR as VARCHAR(1) DECLARE @SP INT DECLARE @VALUE VARCHAR(1000)
|
||||
SET
|
||||
@SEPERATOR = ',' CREATE TABLE #tempTab (ActionItemResponsible int not null)
|
||||
WHILE PATINDEX('%' + @SEPERATOR + '%', @ResponsibleID) <> 0 BEGIN
|
||||
SELECT
|
||||
@SP = PATINDEX('%' + @SEPERATOR + '%', @ResponsibleID)
|
||||
SELECT
|
||||
@VALUE = LEFT(@ResponsibleID, @SP - 1)
|
||||
SELECT
|
||||
@ResponsibleID = STUFF(@ResponsibleID, 1, @SP, '')
|
||||
INSERT INTO
|
||||
#tempTab (ActionItemResponsible) VALUES (@VALUE)
|
||||
END
|
||||
DELETE FROM
|
||||
CCPCRBActionItemResponsible
|
||||
WHERE
|
||||
PCRBActionItemID = @PCRBActionItemID
|
||||
INSERT INTO
|
||||
CCPCRBActionItemResponsible
|
||||
SELECT
|
||||
@PCRBActionItemID,
|
||||
ActionItemResponsible
|
||||
FROM
|
||||
#tempTab
|
||||
DROP TABLE #tempTab
|
||||
END
|
||||
GO
|
28
Programmability/Stored Procedures/CCInsertPartNumber.sql
Normal file
28
Programmability/Stored Procedures/CCInsertPartNumber.sql
Normal file
@ -0,0 +1,28 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCInsertPartNumber] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCInsertPartNumber] -- Add the parameters for the stored procedure here
|
||||
@PlanNumber INT,
|
||||
@PartNumber VARCHAR(50) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
INSERT INTO
|
||||
CCPartNumber (PlanNumber, PartNumberID)
|
||||
VALUES
|
||||
(@PlanNumber, @PartNumber)
|
||||
END
|
||||
GO
|
28
Programmability/Stored Procedures/CCInsertProcess.sql
Normal file
28
Programmability/Stored Procedures/CCInsertProcess.sql
Normal file
@ -0,0 +1,28 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCInsertProcess] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCInsertProcess] -- Add the parameters for the stored procedure here
|
||||
@PlanNumber INT,
|
||||
@ProcessID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
INSERT INTO
|
||||
CCProcess (PlanNumber, ProcessID)
|
||||
VALUES
|
||||
(@PlanNumber, @ProcessID)
|
||||
END
|
||||
GO
|
28
Programmability/Stored Procedures/CCInsertToolType.sql
Normal file
28
Programmability/Stored Procedures/CCInsertToolType.sql
Normal file
@ -0,0 +1,28 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCInsertToolType] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCInsertToolType] -- Add the parameters for the stored procedure here
|
||||
@PlanNumber INT,
|
||||
@ToolTypeID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
INSERT INTO
|
||||
CCToolType (PlanNumber, ToolTypeID)
|
||||
VALUES
|
||||
(@PlanNumber, @ToolTypeID)
|
||||
END
|
||||
GO
|
59
Programmability/Stored Procedures/CCReassignOwner.sql
Normal file
59
Programmability/Stored Procedures/CCReassignOwner.sql
Normal file
@ -0,0 +1,59 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCReassignOwner] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[CCReassignOwner] @PlanNumber int,
|
||||
@NewOwnerID int,
|
||||
@Comments varchar(500),
|
||||
@UserID int AS BEGIN
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
SET
|
||||
XACT_ABORT ON;
|
||||
|
||||
BEGIN TRANSACTION
|
||||
INSERT INTO
|
||||
EventLog(
|
||||
[IssueID],
|
||||
[SysDocumentID],
|
||||
[UserID],
|
||||
[DocumentType],
|
||||
[OperationType],
|
||||
[Comments],
|
||||
[InsertTimeStamp]
|
||||
)
|
||||
SELECT
|
||||
@PlanNumber,
|
||||
NULL,
|
||||
@UserID,
|
||||
'ChangeControl',
|
||||
'Reassign Owner',
|
||||
LEFT(
|
||||
'Owner changed from ' + ISNULL(
|
||||
old.LoginID,
|
||||
CONVERT(varchar(20), CCChangeControl.OwnerID)
|
||||
) + ' to ' + ISNULL(new.LoginID, CONVERT(varchar(20), @NewOwnerID)) + ' by ' + ISNULL(me.LoginID, CONVERT(varchar(20), @UserID)) + ' comments: ' + @Comments,
|
||||
500
|
||||
),
|
||||
GETDATE()
|
||||
FROM
|
||||
CCChangeControl
|
||||
LEFT OUTER JOIN Users old ON old.UserID = CCChangeControl.OwnerID
|
||||
LEFT OUTER JOIN Users new ON new.UserID = @NewOwnerID
|
||||
LEFT OUTER JOIN Users me ON me.UserID = @UserID
|
||||
WHERE
|
||||
CCChangeControl.PlanNumber = @PlanNumber
|
||||
UPDATE
|
||||
CCChangeControl
|
||||
SET
|
||||
OwnerID = @NewOwnerID
|
||||
WHERE
|
||||
PlanNumber = @PlanNumber COMMIT TRANSACTION
|
||||
END
|
||||
GO
|
@ -0,0 +1,92 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCReleaseLockOnCCDocuments] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCReleaseLockOnCCDocuments] -- Add the parameters for the stored procedure here
|
||||
@PlanNumber INT,
|
||||
@UserID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
IF @UserID <> -1 BEGIN
|
||||
UPDATE
|
||||
CCChangeControl
|
||||
SET
|
||||
RecordLockIndicator = 0,
|
||||
RecordLockedBy = NULL,
|
||||
RecordLockedDate = NULL
|
||||
WHERE
|
||||
RecordLockedBy = @UserID
|
||||
UPDATE
|
||||
CCMeeting
|
||||
SET
|
||||
RecordLockIndicator = 0,
|
||||
RecordLockedBy = NULL,
|
||||
RecordLockedDate = NULL
|
||||
WHERE
|
||||
RecordLockedBy = @UserID
|
||||
INSERT INTO
|
||||
EventLog (
|
||||
IssueID,
|
||||
UserID,
|
||||
DocumentType,
|
||||
OperationType,
|
||||
Comments
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@PlanNumber,
|
||||
@UserID,
|
||||
'ChangeControl',
|
||||
'ReleaseLock',
|
||||
'Released Lock on all Change COntrol docs locked by this userid'
|
||||
)
|
||||
END
|
||||
ELSE BEGIN
|
||||
UPDATE
|
||||
CCChangeControl
|
||||
SET
|
||||
RecordLockIndicator = 0,
|
||||
RecordLockedBy = NULL,
|
||||
RecordLockedDate = NULL
|
||||
WHERE
|
||||
PlanNumber = @PlanNumber
|
||||
UPDATE
|
||||
CCMeeting
|
||||
SET
|
||||
RecordLockIndicator = 0,
|
||||
RecordLockedBy = NULL,
|
||||
RecordLockedDate = NULL
|
||||
WHERE
|
||||
PlanNumber = @PlanNumber
|
||||
INSERT INTO
|
||||
EventLog (
|
||||
IssueID,
|
||||
UserID,
|
||||
DocumentType,
|
||||
OperationType,
|
||||
Comments
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@PlanNumber,
|
||||
@UserID,
|
||||
'ChangeControl',
|
||||
'ReleaseLock',
|
||||
'Released Lock on all Change COntrol docs locked by this userid'
|
||||
)
|
||||
END
|
||||
END
|
||||
GO
|
103
Programmability/Stored Procedures/CCUnlockCC.sql
Normal file
103
Programmability/Stored Procedures/CCUnlockCC.sql
Normal file
@ -0,0 +1,103 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCUnlockCC] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCUnlockCC] AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
SELECT
|
||||
212 AS UserID,
|
||||
CC.PlanNumber AS IssueID,
|
||||
CC.PlanNumber AS SysDocumentID,
|
||||
'ChangeControl' AS DocumentType,
|
||||
'Record UnLock' AS OperationType,
|
||||
'Record locked by ' + U.FirstName + ' ' + U.LastName + ' on ' + CONVERT(VARCHAR(20), RecordLockedDate) + ' was Unlocked on ' + CONVERT(VARCHAR(20), GETDATE()) AS Comments,
|
||||
GETDATE() AS InsertTimeStamp INTO #TempLockedRecords
|
||||
FROM
|
||||
CCChangeControl CC
|
||||
INNER JOIN Users U ON CC.RecordLockedBy = U.UserID
|
||||
WHERE
|
||||
DATEDIFF(MI, RecordLockedDate, GETDATE()) > 30
|
||||
AND DATEDIFF(MI, LastUpdateDate, GETDATE()) > 30
|
||||
INSERT INTO
|
||||
EventLog (
|
||||
UserID,
|
||||
IssueID,
|
||||
SysDocumentID,
|
||||
DocumentType,
|
||||
OperationType,
|
||||
Comments,
|
||||
InsertTimeStamp
|
||||
)
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
#TempLockedRecords
|
||||
UPDATE
|
||||
CCChangeControl
|
||||
SET
|
||||
RecordLockindicator = 0,
|
||||
RecordLockedBy = NULL,
|
||||
RecordLockedDate = NULL
|
||||
WHERE
|
||||
PlanNumber IN (
|
||||
SELECT
|
||||
SysDocumentID
|
||||
FROM
|
||||
#TempLockedRecords)
|
||||
DROP TABLE #TempLockedRecords
|
||||
SELECT
|
||||
212 AS UserID,
|
||||
M.MeetingID AS IssueID,
|
||||
M.MeetingID AS SysDocumentID,
|
||||
'CCMeeting' AS DocumentType,
|
||||
'Record UnLock' AS OperationType,
|
||||
'Record locked by ' + U.FirstName + ' ' + U.LastName + ' on ' + CONVERT(VARCHAR(20), RecordLockedDate) + ' was Unlocked on ' + CONVERT(VARCHAR(20), GETDATE()) AS Comments,
|
||||
GETDATE() AS InsertTimeStamp INTO #NewTempLockedRecords
|
||||
FROM
|
||||
CCMeeting M
|
||||
INNER JOIN Users U ON M.RecordLockedBy = U.UserID
|
||||
WHERE
|
||||
DATEDIFF(MI, RecordLockedDate, GETDATE()) > 30
|
||||
AND DATEDIFF(MI, LastUpdateDate, GETDATE()) > 30
|
||||
INSERT INTO
|
||||
EventLog (
|
||||
UserID,
|
||||
IssueID,
|
||||
SysDocumentID,
|
||||
DocumentType,
|
||||
OperationType,
|
||||
Comments,
|
||||
InsertTimeStamp
|
||||
)
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
#NewTempLockedRecords
|
||||
UPDATE
|
||||
CCMeeting
|
||||
SET
|
||||
RecordLockindicator = 0,
|
||||
RecordLockedBy = NULL,
|
||||
RecordLockedDate = NULL
|
||||
WHERE
|
||||
MeetingID IN (
|
||||
SELECT
|
||||
SysDocumentID
|
||||
FROM
|
||||
#NewTempLockedRecords)
|
||||
DROP TABLE #NewTempLockedRecords
|
||||
END
|
||||
GO
|
62
Programmability/Stored Procedures/CCUnlockChangeControl.sql
Normal file
62
Programmability/Stored Procedures/CCUnlockChangeControl.sql
Normal file
@ -0,0 +1,62 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCUnlockChangeControl] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCUnlockChangeControl] AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
SELECT
|
||||
212 AS UserID,
|
||||
PlanNumber AS IssueID,
|
||||
PlanNumber AS SysDocumentID,
|
||||
'ChangeControl' AS DocumentType,
|
||||
'Record UnLock' AS OperationType,
|
||||
'Record locked by ' + U.FirstName + ' ' + U.LastName + ' on ' + CONVERT(VARCHAR(20), RecordLockedDate) + ' was Unlocked on ' + CONVERT(VARCHAR(20), GETDATE()) AS Comments,
|
||||
GETDATE() AS InsertTimeStamp INTO #TempLockedRecords
|
||||
FROM
|
||||
CCChangeControl WR
|
||||
INNER JOIN Users U ON WR.RecordLockedBy = U.UserID
|
||||
WHERE
|
||||
DATEDIFF(MI, RecordLockedDate, GETDATE()) > 30
|
||||
AND DATEDIFF(MI, LastUpdateDate, GETDATE()) > 30
|
||||
INSERT INTO
|
||||
EventLog (
|
||||
UserID,
|
||||
IssueID,
|
||||
SysDocumentID,
|
||||
DocumentType,
|
||||
OperationType,
|
||||
Comments,
|
||||
InsertTimeStamp
|
||||
)
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
#TempLockedRecords
|
||||
UPDATE
|
||||
CCChangeControl
|
||||
SET
|
||||
RecordLockedBy = NULL,
|
||||
RecordLockIndicator = 0,
|
||||
RecordLockedDate = NULl
|
||||
WHERE
|
||||
PlanNumber IN (
|
||||
SELECT
|
||||
SysDocumentID
|
||||
FROM
|
||||
#TempLockedRecords)
|
||||
DROP TABLE #TempLockedRecords
|
||||
END
|
||||
GO
|
62
Programmability/Stored Procedures/CCUnlockMeeting.sql
Normal file
62
Programmability/Stored Procedures/CCUnlockMeeting.sql
Normal file
@ -0,0 +1,62 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCUnlockMeeting] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCUnlockMeeting] AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
SELECT
|
||||
212 AS UserID,
|
||||
MeetingID AS IssueID,
|
||||
MeetingID AS SysDocumentID,
|
||||
'Meeting' AS DocumentType,
|
||||
'Record UnLock' AS OperationType,
|
||||
'Record locked by ' + U.FirstName + ' ' + U.LastName + ' on ' + CONVERT(VARCHAR(20), RecordLockedDate) + ' was Unlocked on ' + CONVERT(VARCHAR(20), GETDATE()) AS Comments,
|
||||
GETDATE() AS InsertTimeStamp INTO #TempLockedRecords
|
||||
FROM
|
||||
CCMeeting WR
|
||||
INNER JOIN Users U ON WR.RecordLockedBy = U.UserID
|
||||
WHERE
|
||||
DATEDIFF(MI, RecordLockedDate, GETDATE()) > 30
|
||||
AND DATEDIFF(MI, LastUpdateDate, GETDATE()) > 30
|
||||
INSERT INTO
|
||||
EventLog (
|
||||
UserID,
|
||||
IssueID,
|
||||
SysDocumentID,
|
||||
DocumentType,
|
||||
OperationType,
|
||||
Comments,
|
||||
InsertTimeStamp
|
||||
)
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
#TempLockedRecords
|
||||
UPDATE
|
||||
CCMeeting
|
||||
SET
|
||||
RecordLockedBy = NULL,
|
||||
RecordLockIndicator = 0,
|
||||
RecordLockedDate = NULl
|
||||
WHERE
|
||||
MeetingID IN (
|
||||
SELECT
|
||||
SysDocumentID
|
||||
FROM
|
||||
#TempLockedRecords)
|
||||
DROP TABLE #TempLockedRecords
|
||||
END
|
||||
GO
|
@ -0,0 +1,34 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCUpdateActionItemAttachment] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCUpdateActionItemAttachment] @ID INT,
|
||||
@FileName VARCHAR(100),
|
||||
@FileGUID VARCHAR(50),
|
||||
@UploadedByID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
UPDATE
|
||||
CCMeetingActionItem
|
||||
SET
|
||||
FileName = @FileName,
|
||||
FileGUID = @FileGUID,
|
||||
UploadedByID = @UploadedByID,
|
||||
UploadDateTime = GETDATE()
|
||||
WHERE
|
||||
ID = @ID
|
||||
END
|
||||
GO
|
32
Programmability/Stored Procedures/CCUpdateCCAttachment.sql
Normal file
32
Programmability/Stored Procedures/CCUpdateCCAttachment.sql
Normal file
@ -0,0 +1,32 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCUpdateCCAttachment] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCUpdateCCAttachment] -- Add the parameters for the stored procedure here
|
||||
@ID INT,
|
||||
@Title VARCHAR(100),
|
||||
@RequirementsNotes VARCHAR(500) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
UPDATE
|
||||
CCAttachment
|
||||
SET
|
||||
Title = @Title,
|
||||
RequirementsNotes = @RequirementsNotes
|
||||
WHERE
|
||||
ID = @ID
|
||||
END
|
||||
GO
|
@ -0,0 +1,34 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCUpdateCCAttachmentDocument] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCUpdateCCAttachmentDocument] @AttachmentID INT,
|
||||
@FileName VARCHAR(100),
|
||||
@FileGUID VARCHAR(50),
|
||||
@UploadedByID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
UPDATE
|
||||
CCAttachment
|
||||
SET
|
||||
FileName = @FileName,
|
||||
FileGUID = @FileGUID,
|
||||
UploadedByID = @UploadedByID,
|
||||
UploadDateTime = GETDATE()
|
||||
WHERE
|
||||
ID = @AttachmentID
|
||||
END
|
||||
GO
|
52
Programmability/Stored Procedures/CCUpdateChangeControl.sql
Normal file
52
Programmability/Stored Procedures/CCUpdateChangeControl.sql
Normal file
@ -0,0 +1,52 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCUpdateChangeControl] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCUpdateChangeControl] @PlanNumber INT,
|
||||
@ChangeLevel INT,
|
||||
@IsITAR INT,
|
||||
@IsMedical INT,
|
||||
@IsRadHard INT,
|
||||
@Notes VARCHAR(1000),
|
||||
--@PartNumbers VARCHAR(100),
|
||||
--@ToolTypes VARCHAR(500),
|
||||
@IsAutomotive INT,
|
||||
@Title VARCHAR(100),
|
||||
@ReasonForChange VARCHAR(2000),
|
||||
@ChangeDescription VARCHAR(2000) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
UPDATE
|
||||
CCChangeControl
|
||||
SET
|
||||
ChangeLevel = CASE
|
||||
WHEN @ChangeLevel = -1 THEN NULL
|
||||
ELSE @ChangeLevel
|
||||
END,
|
||||
IsITAR = @IsITAR,
|
||||
IsMedical = @IsMedical,
|
||||
IsRadHard = @IsRadHard,
|
||||
IsAutoMotive = @IsAutomotive,
|
||||
Notes = @Notes,
|
||||
--PartNumbers = @PartNumbers,
|
||||
--ToolTypes = @ToolTypes,
|
||||
Title = @Title,
|
||||
ReasonForChange = @ReasonForChange,
|
||||
ChangeDescription = @ChangeDescription
|
||||
WHERE
|
||||
PlanNumber = @PlanNumber
|
||||
END
|
||||
GO
|
@ -0,0 +1,30 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCUpdateDecisionSummary] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCUpdateDecisionSummary] -- Add the parameters for the stored procedure here
|
||||
@ID INT,
|
||||
@DecisionNotes VARCHAR(2000) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
UPDATE
|
||||
CCDecisionSummary
|
||||
SET
|
||||
DecisionNotes = @DecisionNotes
|
||||
WHERE
|
||||
ID = @ID
|
||||
END
|
||||
GO
|
@ -0,0 +1,32 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCUpdateDecisionSummaryLinks] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCUpdateDecisionSummaryLinks] -- Add the parameters for the stored procedure here
|
||||
@ID INT,
|
||||
@ECNLinks VARCHAR(100),
|
||||
@LotDispoLinks VARCHAR(100) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
UPDATE
|
||||
CCDecisionSummary
|
||||
SET
|
||||
ECNLinks = @ECNLinks,
|
||||
LotDispoLinks = @LotDispoLinks
|
||||
WHERE
|
||||
ID = @ID
|
||||
END
|
||||
GO
|
35
Programmability/Stored Procedures/CCUpdateMeeting.sql
Normal file
35
Programmability/Stored Procedures/CCUpdateMeeting.sql
Normal file
@ -0,0 +1,35 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCUpdateMeeting] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCUpdateMeeting] -- Add the parameters for the stored procedure here
|
||||
@MeetingID INT,
|
||||
@PCRB VARCHAR(100) = NULL,
|
||||
@MeetingDate DATETIME,
|
||||
@Decision INT,
|
||||
@Notes VARCHAR(1000) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
UPDATE
|
||||
CCMeeting
|
||||
SET
|
||||
MeetingDate = @MeetingDate,
|
||||
Notes = @Notes,
|
||||
Decision = @Decision
|
||||
WHERE
|
||||
MeetingID = @MeetingID
|
||||
END
|
||||
GO
|
@ -0,0 +1,59 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCUpdateMeetingActionItem] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCUpdateMeetingActionItem] @ID INT,
|
||||
@ActionItemName VARCHAR(500),
|
||||
--@ResponsiblePerson Varchar(50),
|
||||
@ResponsibleID Varchar(100),
|
||||
@Gating BIT,
|
||||
@DueDate DATETIME AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
UPDATE
|
||||
CCMeetingActionItem
|
||||
SET
|
||||
ActionItemName = @ActionItemName,
|
||||
Gating = @Gating,
|
||||
DueDate = @DueDate
|
||||
WHERE
|
||||
ID = @ID DECLARE @SEPERATOR as VARCHAR(1) DECLARE @SP INT DECLARE @VALUE VARCHAR(1000)
|
||||
SET
|
||||
@SEPERATOR = ',' CREATE TABLE #tempTab (ActionItemResponsible int not null)
|
||||
WHILE PATINDEX('%' + @SEPERATOR + '%', @ResponsibleID) <> 0 BEGIN
|
||||
SELECT
|
||||
@SP = PATINDEX('%' + @SEPERATOR + '%', @ResponsibleID)
|
||||
SELECT
|
||||
@VALUE = LEFT(@ResponsibleID, @SP - 1)
|
||||
SELECT
|
||||
@ResponsibleID = STUFF(@ResponsibleID, 1, @SP, '')
|
||||
INSERT INTO
|
||||
#tempTab (ActionItemResponsible) VALUES (@VALUE)
|
||||
END
|
||||
DELETE FROM
|
||||
CCMeetingActionItemResponsible
|
||||
WHERE
|
||||
MeetingActionItemID = @ID
|
||||
INSERT INTO
|
||||
CCMeetingActionItemResponsible
|
||||
SELECT
|
||||
@ID,
|
||||
ActionItemResponsible
|
||||
FROM
|
||||
#tempTab
|
||||
DROP TABLE #tempTab
|
||||
END
|
||||
GO
|
@ -0,0 +1,112 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCUpdateMeetingActionItemRespPersons] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[CCUpdateMeetingActionItemRespPersons] @MeetingActionItemID int,
|
||||
@ResponsibleID varchar(100),
|
||||
@Comments varchar(500),
|
||||
@UserID int AS BEGIN
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
SET
|
||||
XACT_ABORT ON;
|
||||
|
||||
BEGIN TRANSACTION DECLARE @SEPERATOR as VARCHAR(1) DECLARE @SP INT DECLARE @VALUE VARCHAR(1000)
|
||||
SET
|
||||
@SEPERATOR = ',' CREATE TABLE #tempTab (ActionItemResponsible int not null, LoginID varchar(50) not null)
|
||||
WHILE PATINDEX('%' + @SEPERATOR + '%', @ResponsibleID) <> 0 BEGIN
|
||||
SELECT
|
||||
@SP = PATINDEX('%' + @SEPERATOR + '%', @ResponsibleID)
|
||||
SELECT
|
||||
@VALUE = LEFT(@ResponsibleID, @SP - 1)
|
||||
SELECT
|
||||
@ResponsibleID = STUFF(@ResponsibleID, 1, @SP, '')
|
||||
INSERT INTO
|
||||
#tempTab (ActionItemResponsible, LoginID)
|
||||
SELECT
|
||||
UserID,
|
||||
LoginID
|
||||
FROM
|
||||
Users
|
||||
WHERE
|
||||
UserID = @VALUE
|
||||
END
|
||||
INSERT INTO
|
||||
#tempTab (ActionItemResponsible, LoginID)
|
||||
SELECT
|
||||
UserID,
|
||||
LoginID
|
||||
FROM
|
||||
Users
|
||||
WHERE
|
||||
UserID = @ResponsibleID DECLARE @NewRPs varchar(500)
|
||||
SELECT
|
||||
@NewRPs = STUFF(
|
||||
(
|
||||
SELECT
|
||||
',' + RTRIM(LoginID)
|
||||
FROM
|
||||
#tempTab FOR XML PATH('')), 1, 1, '')
|
||||
DECLARE @OldRPs varchar(500)
|
||||
SELECT
|
||||
@OldRPs = STUFF(
|
||||
(
|
||||
SELECT
|
||||
',' + RTRIM(U.LoginID)
|
||||
FROM
|
||||
CCMeetingActionItemResponsible AIR
|
||||
INNER JOIN Users U ON AIR.ActionItemResponsible = U.UserID
|
||||
WHERE
|
||||
AIR.MeetingActionItemID = @MeetingActionItemID FOR XML PATH('')
|
||||
),
|
||||
1,
|
||||
1,
|
||||
''
|
||||
)
|
||||
INSERT INTO
|
||||
EventLog(
|
||||
[IssueID],
|
||||
[SysDocumentID],
|
||||
[UserID],
|
||||
[DocumentType],
|
||||
[OperationType],
|
||||
[Comments],
|
||||
[InsertTimeStamp]
|
||||
)
|
||||
SELECT
|
||||
@MeetingActionItemID,
|
||||
NULL,
|
||||
@UserID,
|
||||
'MeetingActionItem',
|
||||
'Reassign Responsible Persons',
|
||||
LEFT(
|
||||
'Responsible persons changed from ' + @OldRPs + ' to ' + @NewRPs + ' by ' + ISNULL(me.LoginID, CONVERT(varchar(20), @UserID)) + ' comments: ' + @Comments,
|
||||
500
|
||||
),
|
||||
GETDATE()
|
||||
FROM
|
||||
CCMeetingActionItem
|
||||
LEFT OUTER JOIN Users me ON me.UserID = @UserID
|
||||
WHERE
|
||||
CCMeetingActionItem.ID = @MeetingActionItemID
|
||||
DELETE FROM
|
||||
CCMeetingActionItemResponsible
|
||||
WHERE
|
||||
MeetingActionItemID = @MeetingActionItemID
|
||||
INSERT INTO
|
||||
CCMeetingActionItemResponsible
|
||||
SELECT
|
||||
@MeetingActionItemID,
|
||||
ActionItemResponsible
|
||||
FROM
|
||||
#tempTab
|
||||
DROP TABLE #tempTab
|
||||
COMMIT TRANSACTION
|
||||
END
|
||||
GO
|
@ -0,0 +1,55 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCUpdateMeetingActionItem_All] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCUpdateMeetingActionItem_All] @ID INT,
|
||||
@Updates VARCHAR(100),
|
||||
@ClosedStatus BIT,
|
||||
@DueDate DATE,
|
||||
@UserID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
IF @ClosedStatus = 1
|
||||
AND (
|
||||
SELECT
|
||||
ClosedStatus
|
||||
FROM
|
||||
CCMeetingActionItem
|
||||
WHERE
|
||||
ID = @ID
|
||||
) = 0
|
||||
UPDATE
|
||||
CCMeetingActionItem
|
||||
SET
|
||||
ClosedDate = GETDATE(),
|
||||
ClosedBy = @UserID
|
||||
WHERE
|
||||
ID = @ID
|
||||
UPDATE
|
||||
CCMeetingActionItem
|
||||
SET
|
||||
Updates = @Updates,
|
||||
ClosedStatus = @ClosedStatus,
|
||||
DueDate = @DueDate
|
||||
WHERE
|
||||
ID = @ID IF @ClosedStatus = 0
|
||||
UPDATE
|
||||
CCMeetingActionItem
|
||||
SET
|
||||
ClosedDate = NULL
|
||||
WHERE
|
||||
ID = @ID
|
||||
END
|
||||
GO
|
@ -0,0 +1,30 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCUpdateMeetingAttachmentAttrib] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCUpdateMeetingAttachmentAttrib] -- Add the parameters for the stored procedure here
|
||||
@ID INT,
|
||||
@Title VARCHAR(100) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
UPDATE
|
||||
CCMeetingAttachment
|
||||
SET
|
||||
Title = @Title
|
||||
WHERE
|
||||
ID = @ID
|
||||
END
|
||||
GO
|
@ -0,0 +1,34 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCUpdateMeetingAttachmentDocument] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCUpdateMeetingAttachmentDocument] @AttachmentID INT,
|
||||
@FileName VARCHAR(100),
|
||||
@FileGUID VARCHAR(50),
|
||||
@UploadedByID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
UPDATE
|
||||
CCMeetingAttachment
|
||||
SET
|
||||
FileName = @FileName,
|
||||
FileGUID = @FileGUID,
|
||||
UploadedByID = @UploadedByID,
|
||||
UploadDateTime = GETDATE()
|
||||
WHERE
|
||||
ID = @AttachmentID
|
||||
END
|
||||
GO
|
@ -0,0 +1,33 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCUpdateMeetingAttendee] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCUpdateMeetingAttendee] @ID INT,
|
||||
@AttendeeName VARCHAR(300),
|
||||
@JobTitle VARCHAR(300),
|
||||
@Site VARCHAR(50) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
UPDATE
|
||||
CCMeetingAttendee
|
||||
SET
|
||||
AttendeeName = @AttendeeName,
|
||||
JobTitle = @JobTitle,
|
||||
Location = @Site
|
||||
WHERE
|
||||
ID = @ID
|
||||
END
|
||||
GO
|
30
Programmability/Stored Procedures/CCUpdateMeetingNotes.sql
Normal file
30
Programmability/Stored Procedures/CCUpdateMeetingNotes.sql
Normal file
@ -0,0 +1,30 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCUpdateMeetingNotes] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCUpdateMeetingNotes] -- Add the parameters for the stored procedure here
|
||||
@ID INT,
|
||||
@Notes VARCHAR(500) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
UPDATE
|
||||
CCMeeting
|
||||
SET
|
||||
Notes = ISNULL(Notes, '') + CHAR(10) + CHAR(10) + 'LastUpdateDate: ' + CONVERT(VARCHAR(12), GETDATE()) + CHAR(10) + Notes
|
||||
WHERE
|
||||
MeetingID = @ID
|
||||
END
|
||||
GO
|
59
Programmability/Stored Procedures/CCUpdatePCRBActionItem.sql
Normal file
59
Programmability/Stored Procedures/CCUpdatePCRBActionItem.sql
Normal file
@ -0,0 +1,59 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCUpdatePCRBActionItem] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCUpdatePCRBActionItem] @ID INT,
|
||||
@ActionItemName VARCHAR(500),
|
||||
--@ResponsiblePerson Varchar(50),
|
||||
@ResponsibleID Varchar(100),
|
||||
@Gating BIT,
|
||||
@DueDate DATETIME AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
UPDATE
|
||||
CCPCRBActionItem
|
||||
SET
|
||||
ActionItemName = @ActionItemName,
|
||||
Gating = @Gating,
|
||||
DueDate = @DueDate
|
||||
WHERE
|
||||
ID = @ID DECLARE @SEPERATOR as VARCHAR(1) DECLARE @SP INT DECLARE @VALUE VARCHAR(1000)
|
||||
SET
|
||||
@SEPERATOR = ',' CREATE TABLE #tempTab (ActionItemResponsible int not null)
|
||||
WHILE PATINDEX('%' + @SEPERATOR + '%', @ResponsibleID) <> 0 BEGIN
|
||||
SELECT
|
||||
@SP = PATINDEX('%' + @SEPERATOR + '%', @ResponsibleID)
|
||||
SELECT
|
||||
@VALUE = LEFT(@ResponsibleID, @SP - 1)
|
||||
SELECT
|
||||
@ResponsibleID = STUFF(@ResponsibleID, 1, @SP, '')
|
||||
INSERT INTO
|
||||
#tempTab (ActionItemResponsible) VALUES (@VALUE)
|
||||
END
|
||||
DELETE FROM
|
||||
CCPCRBActionItemResponsible
|
||||
WHERE
|
||||
PCRBActionItemID = @ID
|
||||
INSERT INTO
|
||||
CCPCRBActionItemResponsible
|
||||
SELECT
|
||||
@ID,
|
||||
ActionItemResponsible
|
||||
FROM
|
||||
#tempTab
|
||||
DROP TABLE #tempTab
|
||||
END
|
||||
GO
|
54
Programmability/Stored Procedures/CCUpdatePCRBAttendee.sql
Normal file
54
Programmability/Stored Procedures/CCUpdatePCRBAttendee.sql
Normal file
@ -0,0 +1,54 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[CCUpdatePCRBAttendee] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[CCUpdatePCRBAttendee] @ID INT,
|
||||
@JobTitle VARCHAR(300),
|
||||
@Site VARCHAR(50),
|
||||
@AttendeeID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
Declare @AttendeeName VARCHAR(300)
|
||||
SET
|
||||
@AttendeeName = CONCAT(
|
||||
(
|
||||
SELECT
|
||||
FirstName
|
||||
FROM
|
||||
Users
|
||||
WHERE
|
||||
UserID = @AttendeeID
|
||||
),
|
||||
' ',
|
||||
(
|
||||
SELECT
|
||||
LastName
|
||||
FROM
|
||||
Users
|
||||
WHERE
|
||||
UserID = @AttendeeID
|
||||
)
|
||||
) -- Insert statements for procedure here
|
||||
UPDATE
|
||||
CCPCRBAttendee
|
||||
SET
|
||||
AttendeeName = @AttendeeName,
|
||||
AttendeeID = @AttendeeID,
|
||||
JobTitle = @JobTitle,
|
||||
Location = @Site
|
||||
WHERE
|
||||
ID = @ID
|
||||
END
|
||||
GO
|
41
Programmability/Stored Procedures/DelegateApproval.sql
Normal file
41
Programmability/Stored Procedures/DelegateApproval.sql
Normal file
@ -0,0 +1,41 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[DelegateApproval] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[DelegateApproval] @IssueID INT,
|
||||
@DelegateFromUser INT,
|
||||
@DelegateToUser INT,
|
||||
@Email VARCHAR(50) OUTPUT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
UPDATE
|
||||
Approval
|
||||
SET
|
||||
ItemStatus = 0,
|
||||
UserID = @DelegateToUser,
|
||||
RoleAssignedDate = GETDATE()
|
||||
WHERE
|
||||
IssueID = @IssueID
|
||||
AND UserID = @DelegateFromUser
|
||||
AND ItemStatus = 0
|
||||
SELECT
|
||||
@Email = Email
|
||||
FROM
|
||||
Users
|
||||
WHERE
|
||||
UserID = @DelegateToUser
|
||||
END
|
||||
GO
|
23
Programmability/Stored Procedures/DeleteLotDisposition.sql
Normal file
23
Programmability/Stored Procedures/DeleteLotDisposition.sql
Normal file
@ -0,0 +1,23 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[DeleteLotDisposition] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[DeleteLotDisposition] @IssueID INT AS DELETE LotDispoDepartment
|
||||
WHERE
|
||||
IssueID = @IssueID DELETE Lot
|
||||
WHERE
|
||||
IssueID = @IssueID DELETE Approval
|
||||
WHERE
|
||||
IssueID = @IssueID DELETE Attachment
|
||||
WHERE
|
||||
IssueID = @IssueID DELETE LotDisposition
|
||||
WHERE
|
||||
IssueID = @IssueID DELETE ScrapLot
|
||||
WHERE
|
||||
IssueID = @IssueID
|
||||
GO
|
@ -0,0 +1,31 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[DeleteLotDispositionAllLots] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[DeleteLotDispositionAllLots] @IssueID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
DELETE SL
|
||||
FROM
|
||||
ScrapLot SL
|
||||
INNER JOIN Lot L ON L.IssueID = SL.IssueID
|
||||
WHERE
|
||||
L.IssueID = @IssueID
|
||||
DELETE FROM
|
||||
Lot
|
||||
WHERE
|
||||
IssueID = @IssueID
|
||||
END
|
||||
GO
|
@ -0,0 +1,25 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[DeleteLotDispositionAttachment] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[DeleteLotDispositionAttachment] @AttachmentID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
DELETE FROM
|
||||
Attachment
|
||||
WHERE
|
||||
AttachmentID = @AttachmentID
|
||||
END
|
||||
GO
|
@ -0,0 +1,24 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[DeleteLotDispositionDepartment] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[DeleteLotDispositionDepartment] @IssueID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
DELETE LotDispoDepartment
|
||||
WHERE
|
||||
IssueID = @IssueID
|
||||
END
|
||||
GO
|
@ -0,0 +1,32 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[DeleteLotDispositionLot] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[DeleteLotDispositionLot] @LotID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
DELETE SL
|
||||
FROM
|
||||
ScrapLot SL
|
||||
INNER JOIN Lot L ON SL.LotNo = L.LotNumber
|
||||
AND L.IssueID = SL.IssueID
|
||||
WHERE
|
||||
L.LotID = @LotID
|
||||
DELETE FROM
|
||||
Lot
|
||||
WHERE
|
||||
LotID = @LotID
|
||||
END
|
||||
GO
|
@ -0,0 +1,36 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[DeleteUserFromTECNReport] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[DeleteUserFromTECNReport] -- Add the parameters for the stored procedure here
|
||||
@UserID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
IF EXISTS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
TECNNotificationsUsers
|
||||
WHERE
|
||||
UserId = @UserID
|
||||
) BEGIN
|
||||
DELETE FROM
|
||||
TECNNotificationsUsers
|
||||
WHERE
|
||||
UserId = @UserID
|
||||
END
|
||||
END
|
||||
GO
|
@ -0,0 +1,32 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[DeleteUserFromTrainingGroup] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[DeleteUserFromTrainingGroup] -- Add the parameters for the stored procedure here
|
||||
@UserID INT,
|
||||
@GroupID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
IF @UserID IS NOT NULL
|
||||
AND @UserID != '' BEGIN
|
||||
DELETE FROM
|
||||
TrainingGroupMembers
|
||||
WHERE
|
||||
TrainingGroupID = @GroupID
|
||||
AND UserID = @UserID
|
||||
END
|
||||
END
|
||||
GO
|
@ -0,0 +1,36 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[DeleteUserFromTrainingReport] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[DeleteUserFromTrainingReport] -- Add the parameters for the stored procedure here
|
||||
@UserID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
IF EXISTS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
TrainingReportUsers
|
||||
WHERE
|
||||
UserId = @UserID
|
||||
) BEGIN
|
||||
DELETE FROM
|
||||
TrainingReportUsers
|
||||
WHERE
|
||||
UserId = @UserID
|
||||
END
|
||||
END
|
||||
GO
|
120
Programmability/Stored Procedures/ECNApproveCancelDocument.sql
Normal file
120
Programmability/Stored Procedures/ECNApproveCancelDocument.sql
Normal file
@ -0,0 +1,120 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[ECNApproveCancelDocument] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[ECNApproveCancelDocument] -- Add the parameters for the stored procedure here
|
||||
@IssueID INT,
|
||||
@CurrentStep INT,
|
||||
@ItemStatus INT,
|
||||
@UserID INT,
|
||||
@Comments VARCHAR(1000),
|
||||
@SubRoleCategoriesClause VARCHAR(500),
|
||||
@DocumentTypeID INT,
|
||||
@LastStep BIT OUTPUT,
|
||||
@LastApproverInCurrentStep BIT OUTPUT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
DECLARE @ApprovalType INT DECLARE @MaxStep INT DECLARE @RemainingApprovers INT DECLARE @NewStep INT DECLARE @ApproverCountForThisStep INT DECLARE @SubRoleID INT
|
||||
SET
|
||||
@NewStep = @CurrentStep + 1
|
||||
SET
|
||||
@SubRoleID = (
|
||||
SELECT
|
||||
TOP 1 SubRoleID
|
||||
FROM
|
||||
Approval
|
||||
WHERE
|
||||
IssueID = @IssueID
|
||||
AND UserID = @UserID
|
||||
AND Step = @CurrentStep
|
||||
AND DocumentTypeID = @DocumentTypeID
|
||||
) IF @ItemStatus = 1 -- Approve
|
||||
BEGIN
|
||||
UPDATE
|
||||
Approval
|
||||
SET
|
||||
ItemStatus = 1,
|
||||
CompletedDate = GETDATE(),
|
||||
Comments = @Comments
|
||||
WHERE
|
||||
IssueID = @IssueID
|
||||
AND UserID = @UserID
|
||||
AND Step = @CurrentStep
|
||||
AND DocumentTypeID = @DocumentTypeID
|
||||
AND CompletedDate IS NULL IF @ @ROWCOUNT > 0 BEGIN
|
||||
INSERT INTO
|
||||
ApprovalLog (
|
||||
IssueID,
|
||||
UserID,
|
||||
SubRoleID,
|
||||
OperationType,
|
||||
OperationLog,
|
||||
DocumentTypeID
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@IssueID,
|
||||
@UserID,
|
||||
@SubRoleID,
|
||||
'Approved Cancellation',
|
||||
'Approved at step ' + CONVERT(NCHAR(10), @CurrentStep),
|
||||
@DocumentTypeID
|
||||
)
|
||||
END
|
||||
SET
|
||||
@RemainingApprovers = (
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
Approval
|
||||
WHERE
|
||||
IssueID = @IssueID
|
||||
AND Step = @CurrentStep
|
||||
AND ItemStatus = 0
|
||||
AND DocumentTypeID = @DocumentTypeID
|
||||
) IF @RemainingApprovers = 0 BEGIN
|
||||
SET
|
||||
@LastStep = 1
|
||||
UPDATE
|
||||
ECN
|
||||
SET
|
||||
CancellationDate = GETDATE(),
|
||||
Cancelled = 1,
|
||||
CancellationInProgress = 0
|
||||
WHERE
|
||||
ECNNumber = @IssueID -- UPDATE THE APPROVAL LOG
|
||||
INSERT INTO
|
||||
ApprovalLog (
|
||||
IssueID,
|
||||
UserID,
|
||||
SubRoleID,
|
||||
OperationType,
|
||||
OperationLog,
|
||||
DocumentTypeID
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@IssueID,
|
||||
@UserID,
|
||||
@SubRoleID,
|
||||
'Cancelled',
|
||||
'Cancelled document',
|
||||
@DocumentTypeID
|
||||
)
|
||||
END
|
||||
ELSE BEGIN
|
||||
SET
|
||||
@LastApproverInCurrentStep = 0
|
||||
END
|
||||
END
|
||||
END
|
||||
GO
|
45
Programmability/Stored Procedures/ECNCanSubmitECN.sql
Normal file
45
Programmability/Stored Procedures/ECNCanSubmitECN.sql
Normal file
@ -0,0 +1,45 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[ECNCanSubmitECN] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[ECNCanSubmitECN] -- Add the parameters for the stored procedure here
|
||||
@ECNNumber INT,
|
||||
@TECNExtensionState BIT OUT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
SET
|
||||
@TECNExtensionState = 0 -- Insert statements for procedure here
|
||||
DECLARE @ConvertedFrom INT
|
||||
SET
|
||||
@ConvertedFrom = (
|
||||
SELECT
|
||||
ConvertedFromNumber
|
||||
FROM
|
||||
ECN
|
||||
WHERE
|
||||
ECNNumber = @ECNNumber
|
||||
) IF NOT @ConvertedFrom IS NULL BEGIN
|
||||
SET
|
||||
@TECNExtensionState = (
|
||||
SELECT
|
||||
TECNExtensionState
|
||||
FROM
|
||||
ECN
|
||||
WHERE
|
||||
ECNNumber = @ConvertedFrom
|
||||
)
|
||||
END
|
||||
END
|
||||
GO
|
32
Programmability/Stored Procedures/ECNCancelECN.sql
Normal file
32
Programmability/Stored Procedures/ECNCancelECN.sql
Normal file
@ -0,0 +1,32 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[ECNCancelECN] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[ECNCancelECN] -- Add the parameters for the stored procedure here
|
||||
@IssueID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
-- Insert statements for procedure here
|
||||
UPDATE
|
||||
ECN
|
||||
SET
|
||||
CancellationInProgress = 0,
|
||||
CancellationApproved = 1,
|
||||
CancellationApprovalDate = GETDATE(),
|
||||
ExpirationDate = NULL
|
||||
WHERE
|
||||
ECNNumber = @IssueID
|
||||
END
|
||||
GO
|
226
Programmability/Stored Procedures/ECNCopyECN.sql
Normal file
226
Programmability/Stored Procedures/ECNCopyECN.sql
Normal file
@ -0,0 +1,226 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[ECNCopyECN] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[ECNCopyECN] -- Add the parameters for the stored procedure here
|
||||
@ECNNumber INT,
|
||||
@NewECNTypeString VARCHAR(50),
|
||||
@TempNewECNNumber INT OUTPUT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
DECLARE @ECN INT DECLARE @TECN INT DECLARE @ETECN INT
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
IF @NewECNTypeString = 'ECN' BEGIN
|
||||
SET
|
||||
@ECN = 1
|
||||
SET
|
||||
@TECN = 0
|
||||
SET
|
||||
@ETECN = 0
|
||||
END
|
||||
ELSE IF @NewECNTypeString = 'TECN' BEGIN
|
||||
SET
|
||||
@ECN = 0
|
||||
SET
|
||||
@TECN = 1
|
||||
SET
|
||||
@ETECN = 0
|
||||
END
|
||||
ELSE IF @NewECNTypeString = 'E-TECN' -- THIS SHOULD NEVER HAPPEN
|
||||
BEGIN
|
||||
SET
|
||||
@ECN = 0
|
||||
SET
|
||||
@TECN = 0
|
||||
SET
|
||||
@ETECN = 1
|
||||
END
|
||||
INSERT INTO
|
||||
ECN (
|
||||
Title,
|
||||
IssueDate,
|
||||
SubmitedDate,
|
||||
CloseDate,
|
||||
OriginatorID,
|
||||
IsECN,
|
||||
IsTECN,
|
||||
IsEmergencyTECN,
|
||||
ExpirationDate,
|
||||
ExtensionDate,
|
||||
CancellationDate,
|
||||
AcknowledgementRequired,
|
||||
TrainingRequired,
|
||||
AreaID,
|
||||
TechnologyID,
|
||||
PCRBRequired,
|
||||
PCRBNumber,
|
||||
TestProgramChangeRequired,
|
||||
SPCChangeRequired,
|
||||
NewPartFlowRequired,
|
||||
SPNChangeRequired,
|
||||
ImplementationDetails,
|
||||
ImpactOnEnvironment,
|
||||
ImpactOnEnvironmentDescription,
|
||||
ImpactOnCapacity,
|
||||
ImpactOnCapacityDescription,
|
||||
IsMA,
|
||||
IsRH,
|
||||
IsAU,
|
||||
IsIndustrial,
|
||||
MaterialConsumptionChangeRequired,
|
||||
MaterialConsumptionChangeDescription,
|
||||
ReasonForChange,
|
||||
DescriptionOfChange,
|
||||
NotAFlowChange,
|
||||
AttachECN_TECNToLots,
|
||||
SPNFlowChangeAtSingleStep,
|
||||
SPNFlowChangeAtMultipleSteps,
|
||||
CurrentStep,
|
||||
TECNExtensionState,
|
||||
Deleted,
|
||||
CancellationApproved,
|
||||
CancellationInProgress,
|
||||
CancellationApprovalDate,
|
||||
ExpirationProcessed,
|
||||
ExpirationInProgress,
|
||||
ExpirationProcessedlDate,
|
||||
ReSubmitted,
|
||||
Converted,
|
||||
ConvertedFromNumber
|
||||
)
|
||||
SELECT
|
||||
Title,
|
||||
IssueDate,
|
||||
NULL AS SubmitedDate,
|
||||
NULL AS CloseDate,
|
||||
OriginatorID,
|
||||
@ECN AS IsECN,
|
||||
@TECN AS IsTECN,
|
||||
@ETECN AS IsEmergencyTECN,
|
||||
NULL AS ExpirationDate,
|
||||
NULL AS ExtensionDate,
|
||||
NULL AS CancellationDate,
|
||||
AcknowledgementRequired,
|
||||
TrainingRequired,
|
||||
AreaID,
|
||||
TechnologyID,
|
||||
PCRBRequired,
|
||||
PCRBNumber,
|
||||
TestProgramChangeRequired,
|
||||
SPCChangeRequired,
|
||||
NewPartFlowRequired,
|
||||
SPNChangeRequired,
|
||||
ImplementationDetails,
|
||||
ImpactOnEnvironment,
|
||||
ImpactOnEnvironmentDescription,
|
||||
ImpactOnCapacity,
|
||||
ImpactOnCapacityDescription,
|
||||
IsMA,
|
||||
IsRH,
|
||||
IsAU,
|
||||
IsIndustrial,
|
||||
MaterialConsumptionChangeRequired,
|
||||
MaterialConsumptionChangeDescription,
|
||||
ReasonForChange,
|
||||
DescriptionOfChange,
|
||||
NotAFlowChange,
|
||||
AttachECN_TECNToLots,
|
||||
SPNFlowChangeAtSingleStep,
|
||||
SPNFlowChangeAtMultipleSteps,
|
||||
0 AS CurrentStep,
|
||||
TECNExtensionState,
|
||||
0 AS Deleted,
|
||||
0 AS CancellationApproved,
|
||||
0 AS CancellationInProgress,
|
||||
0 AS CancellationApprovalDate,
|
||||
0 AS ExpirationProcessed,
|
||||
0 AS ExpirationInProgress,
|
||||
NULL AS ExpirationProcessedlDate,
|
||||
0 AS ReSubmitted,
|
||||
0 AS Converted,
|
||||
@ECNNumber
|
||||
FROM
|
||||
ECN
|
||||
WHERE
|
||||
ECNNumber = @ECNNumber
|
||||
SET
|
||||
@TempNewECNNumber = SCOPE_IDENTITY();
|
||||
|
||||
INSERT INTO
|
||||
ECNAffectedDepartment (DepartmentID, ECNNumber)
|
||||
SELECT
|
||||
DepartmentID,
|
||||
@TempNewECNNumber
|
||||
FROM
|
||||
ECNAffectedDepartment
|
||||
WHERE
|
||||
ECNNumber = @ECNNumber
|
||||
INSERT INTO
|
||||
ECNAffectedModule (ModuleID, ECNNumber)
|
||||
SELECT
|
||||
ModuleID,
|
||||
@TempNewECNNumber
|
||||
FROM
|
||||
ECNAffectedModule
|
||||
WHERE
|
||||
ECNNumber = @ECNNumber
|
||||
INSERT INTO
|
||||
ECNAffectedArea (AreaID, ECNNumber)
|
||||
SELECT
|
||||
AreaID,
|
||||
@TempNewECNNumber
|
||||
FROM
|
||||
ECNAffectedArea
|
||||
WHERE
|
||||
ECNNumber = @ECNNumber
|
||||
INSERT INTO
|
||||
ECNAffectedTechnology (TechnologyID, ECNNumber)
|
||||
SELECT
|
||||
TechnologyID,
|
||||
@TempNewECNNumber
|
||||
FROM
|
||||
ECNAffectedTechnology
|
||||
WHERE
|
||||
ECNNumber = @ECNNumber
|
||||
INSERT INTO
|
||||
ECNAcknowledgementBy (AcknowledgementTrainingByID, ECNNumber)
|
||||
SELECT
|
||||
AcknowledgementTrainingByID,
|
||||
@TempNewECNNumber
|
||||
FROM
|
||||
ECNAcknowledgementBy
|
||||
WHERE
|
||||
ECNNumber = @ECNNumber
|
||||
INSERT INTO
|
||||
ECNTrainingBy (AcknowledgementTrainingByID, ECNNumber)
|
||||
SELECT
|
||||
AcknowledgementTrainingByID,
|
||||
@TempNewECNNumber
|
||||
FROM
|
||||
ECNTrainingBy
|
||||
WHERE
|
||||
ECNNumber = @ECNNumber
|
||||
INSERT INTO
|
||||
ECNAttachment (ECNNumber, [FileName], UserID, UploadDate)
|
||||
SELECT
|
||||
@TempNewECNNumber,
|
||||
[FileName],
|
||||
UserID,
|
||||
UploadDate
|
||||
FROM
|
||||
ECNAttachment
|
||||
WHERE
|
||||
ECNNumber = @ECNNumber
|
||||
END
|
||||
GO
|
@ -0,0 +1,85 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[ECNCreateHistoryAtTECNExtension] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[ECNCreateHistoryAtTECNExtension] @ECNNumber INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
INSERT INTO
|
||||
ECN_History
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
ECN
|
||||
WHERE
|
||||
ECNNumber = @ECNNumber
|
||||
INSERT INTO
|
||||
ECNAcknowledgementBy_History
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
ECNAcknowledgementBy
|
||||
WHERE
|
||||
ECNNumber = @ECNNumber
|
||||
INSERT INTO
|
||||
ECNAffectedArea_History
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
ECNAffectedArea
|
||||
WHERE
|
||||
ECNNumber = @ECNNumber
|
||||
INSERT INTO
|
||||
ECNAffectedDepartment_History
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
ECNAffectedDepartment
|
||||
WHERE
|
||||
ECNNumber = @ECNNumber
|
||||
INSERT INTO
|
||||
ECNAffectedModule_History
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
ECNAffectedModule
|
||||
WHERE
|
||||
ECNNumber = @ECNNumber
|
||||
INSERT INTO
|
||||
ECNAffectedTechnology_History
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
ECNAffectedTechnology
|
||||
WHERE
|
||||
ECNNumber = @ECNNumber
|
||||
INSERT INTO
|
||||
ECNTrainingBy_History
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
ECNTrainingBy
|
||||
WHERE
|
||||
ECNNumber = @ECNNumber
|
||||
INSERT INTO
|
||||
ECNAttachment_History
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
ECNAttachment
|
||||
WHERE
|
||||
ECNNumber = @ECNNumber
|
||||
END
|
||||
GO
|
@ -0,0 +1,24 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[ECNDeleteAcknowledgementBy] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[ECNDeleteAcknowledgementBy] @ECNNumber INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
DELETE ECNAcknowledgementBy
|
||||
WHERE
|
||||
ECNNumber = @ECNNumber
|
||||
END
|
||||
GO
|
24
Programmability/Stored Procedures/ECNDeleteAffectedAreas.sql
Normal file
24
Programmability/Stored Procedures/ECNDeleteAffectedAreas.sql
Normal file
@ -0,0 +1,24 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[ECNDeleteAffectedAreas] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[ECNDeleteAffectedAreas] @ECNNumber INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
DELETE ECNAffectedArea
|
||||
WHERE
|
||||
ECNNumber = @ECNNumber
|
||||
END
|
||||
GO
|
@ -0,0 +1,25 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[ECNDeleteAffectedDepartments] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[ECNDeleteAffectedDepartments] @ECNNumber INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
DELETE FROM
|
||||
ECNAffectedDepartment
|
||||
WHERE
|
||||
ECNNumber = @ECNNumber
|
||||
END
|
||||
GO
|
@ -0,0 +1,24 @@
|
||||
USE [FabApprovalSystem]
|
||||
GO
|
||||
/****** Object: StoredProcedure [dbo].[ECNDeleteAffectedModules] Script Date: 11/21/2024 11:29:04 AM ******/
|
||||
SET
|
||||
ANSI_NULLS ON
|
||||
GO
|
||||
SET
|
||||
QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: <Author,,Name>
|
||||
-- Create date: <Create Date,,>
|
||||
-- Description: <Description,,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[ECNDeleteAffectedModules] @ECNNumber INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET
|
||||
NOCOUNT ON;
|
||||
|
||||
DELETE ECNAffectedModule
|
||||
WHERE
|
||||
ECNNumber = @ECNNumber
|
||||
END
|
||||
GO
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user