init
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,43 @@
|
||||
INSERT INTO [dbo].[ChannelSettings]([SettingName], [DefaultValue]) VALUES ('SquibLimitDuration', 'True');
|
||||
INSERT INTO [dbo].[ChannelSettings]([SettingName], [DefaultValue]) VALUES ('SquibDuration', '10');
|
||||
INSERT INTO [dbo].[ChannelSettings]([SettingName], [DefaultValue]) VALUES ('SquibDelay', '0');
|
||||
INSERT INTO [dbo].[ChannelSettings]([SettingName], [DefaultValue]) VALUES ('DigitalOutLimitDuration', 'True');
|
||||
INSERT INTO [dbo].[ChannelSettings]([SettingName], [DefaultValue]) VALUES ('DigitalOutDuration', '10');
|
||||
INSERT INTO [dbo].[ChannelSettings]([SettingName], [DefaultValue]) VALUES ('DigitalOutDelay', '0');
|
||||
INSERT INTO [dbo].[ChannelSettings]([SettingName], [DefaultValue]) VALUES ('SquibCurrent', '1.5');
|
||||
|
||||
UPDATE [dbo].[ChannelSettings] SET [DefaultValue]='2' WHERE [SettingName]='SQMode' AND [DefaultValue]='1';
|
||||
|
||||
INSERT INTO [dbo].[GroupChannelSettings] ( [ChannelId],[SettingId], [SettingValue] )
|
||||
SELECT [dbo].[GroupChannelSettings].[ChannelId],13,[dbo].[GroupChannelSettings].[SettingValue]
|
||||
FROM [dbo].[GroupChannelSettings]
|
||||
WHERE [SettingId]=5;
|
||||
|
||||
INSERT INTO [dbo].[GroupChannelSettings] ( [ChannelId],[SettingId], [SettingValue] )
|
||||
SELECT [dbo].[GroupChannelSettings].[ChannelId],14,[dbo].[GroupChannelSettings].[SettingValue]
|
||||
FROM [dbo].[GroupChannelSettings]
|
||||
WHERE [SettingId]=6;
|
||||
|
||||
INSERT INTO [dbo].[GroupChannelSettings] ( [ChannelId],[SettingId], [SettingValue] )
|
||||
SELECT [dbo].[GroupChannelSettings].[ChannelId],15,[dbo].[GroupChannelSettings].[SettingValue]
|
||||
FROM [dbo].[GroupChannelSettings]
|
||||
WHERE [SettingId]=7;
|
||||
|
||||
INSERT INTO [dbo].[GroupChannelSettings] ( [ChannelId],[SettingId], [SettingValue] )
|
||||
SELECT [dbo].[GroupChannelSettings].[ChannelId],16,[dbo].[GroupChannelSettings].[SettingValue]
|
||||
FROM [dbo].[GroupChannelSettings]
|
||||
WHERE [SettingId]=5;
|
||||
|
||||
INSERT INTO [dbo].[GroupChannelSettings] ( [ChannelId],[SettingId], [SettingValue] )
|
||||
SELECT [dbo].[GroupChannelSettings].[ChannelId],17,[dbo].[GroupChannelSettings].[SettingValue]
|
||||
FROM [dbo].[GroupChannelSettings]
|
||||
WHERE [SettingId]=6;
|
||||
|
||||
INSERT INTO [dbo].[GroupChannelSettings] ( [ChannelId],[SettingId], [SettingValue] )
|
||||
SELECT [dbo].[GroupChannelSettings].[ChannelId],18,[dbo].[GroupChannelSettings].[SettingValue]
|
||||
FROM [dbo].[GroupChannelSettings]
|
||||
WHERE [SettingId]=7;
|
||||
|
||||
DELETE FROM [dbo].[GroupChannelSettings] WHERE [SettingId] IN (4,5,6,7);
|
||||
|
||||
DELETE FROM [dbo].[ChannelSettings] WHERE [Id] IN (4,5,6,7)
|
||||
@@ -0,0 +1 @@
|
||||
UPDATE DASChannels SET SupportedBridges=16 WHERE DASChannelId IN (66,65,64,63,62,61,60,59,58,57,56,55,54,53,52,51)
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,29 @@
|
||||
ALTER PROCEDURE [dbo].[sp_GroupsDelete]
|
||||
@Id INT,
|
||||
@errorNumber INT OUTPUT,
|
||||
@errorMessage NVARCHAR (255) OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
SET @errorNumber=0
|
||||
SET @errorMessage=''
|
||||
|
||||
/*Delete any channel settings*/
|
||||
DELETE A FROM [dbo].GroupChannelSettings AS A INNER JOIN [dbo].Channels AS B on A.ChannelId=B.Id WHERE B.GroupId=@Id;
|
||||
/*Delete any level triggers*/
|
||||
DELETE A FROM [dbo].LevelTriggers AS A INNER JOIN [dbo].Channels AS B on A.ChannelId=B.Id WHERE B.GroupId=@Id;
|
||||
/*Delete any channels from this group*/
|
||||
DELETE FROM [dbo].Channels WHERE [GroupId] = @Id
|
||||
/*Delete assignment of this group to any tests*/
|
||||
DELETE FROM [dbo].TestSetupGroups WHERE [GroupId]=@Id
|
||||
/*Delete hardware assignments*/
|
||||
DELETE FROM [dbo].GroupHardware WHERE [GroupId]=@Id
|
||||
/*delete group*/
|
||||
DELETE FROM [dbo].Groups WHERE [Id]=@Id
|
||||
|
||||
if(@@error != 0)
|
||||
begin
|
||||
set @errorNumber = error_number()
|
||||
set @errorMessage = error_message()
|
||||
end
|
||||
END
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,84 @@
|
||||
|
||||
ALTER PROCEDURE [dbo].[sp_TestSetupsGet]
|
||||
@TestSetupId int = null,
|
||||
@TestSetupName nvarchar(50) = null
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
if(@TestSetupName is not null)
|
||||
begin
|
||||
set @TestSetupId = dbo.foo_IdGetTestSetup(@TestSetupName)
|
||||
end
|
||||
|
||||
SELECT [TestSetupId]
|
||||
,[TestSetupName] as 'SetupName'
|
||||
,[SetupDescription]
|
||||
,[AutomaticTestProgression]
|
||||
,[AutomaticProgressionDelayMS]
|
||||
,[InvertTrigger]
|
||||
,[InvertStart]
|
||||
,[ViewDiagnostics]
|
||||
,[VerifyChannels]
|
||||
,[AutoVerifyChannels]
|
||||
,[VerifyChannelsDelayMS]
|
||||
,[RecordingMode]
|
||||
,[SamplesPerSecond]
|
||||
,[PreTriggerSeconds]
|
||||
,[PostTriggerSeconds]
|
||||
,[StrictDiagnostics]
|
||||
,[RequireConfirmationOnErrors]
|
||||
,[ROIDownload]
|
||||
,[ViewROIDownload]
|
||||
,[DownloadAll]
|
||||
,[ViewRealtime]
|
||||
,[RealtimePlotCount]
|
||||
,[RegionsOfInterest]
|
||||
,[ROIStart]
|
||||
,[ROIEnd]
|
||||
,[ViewDownloadAll]
|
||||
,[Export]
|
||||
,[ExportFormat]
|
||||
,[LabDetails]
|
||||
,[UseLabDetails]
|
||||
,[CustomerDetails]
|
||||
,[UseCustomerDetails]
|
||||
,[AllowMissingSensors]
|
||||
,[AllowSensorIdToBlankChannel]
|
||||
,[CalibrationBehavior]
|
||||
,[LocalOnly]
|
||||
,[LastModified]
|
||||
,[LastModifiedBy]
|
||||
,[TurnOffExcitation]
|
||||
,[TriggerCheckRealtime]
|
||||
,[TriggerCheckStep]
|
||||
,[PostTestDiagnostics]
|
||||
,[ExportFolder]
|
||||
,[DownloadFolder]
|
||||
,[CommonStatusLine]
|
||||
,[SameAsDownloadFolder]
|
||||
,[UploadData]
|
||||
,[UploadDataFolder]
|
||||
,[UploadExportsOnly]
|
||||
,[Settings]
|
||||
,[WarnOnBatteryFail]
|
||||
,[Dirty]
|
||||
,[Complete]
|
||||
,[ErrorMessage]
|
||||
|
||||
,[TestEngineerDetails]
|
||||
,[UseTestEngineerDetails]
|
||||
,[UserTags]
|
||||
,isnull([DoAutoArm], 0) as [DoAutoArm]
|
||||
,isnull([CheckoutMode], 0) as [CheckoutMode]
|
||||
,isnull([ISFFile], 0) as [ISFFile]
|
||||
,isnull([QuitTestWithoutWarning], 0) as [QuitTestWithoutWarning]
|
||||
,isnull([NotAllChannelsRealTime], 0) as [NotAllChannelsRealTime]
|
||||
,isnull([NotAllChannelsViewer], 0) as [NotAllChannelsViewer]
|
||||
,isnull([SuppressMissingSensorsWarning], 0) as [SuppressMissingSensorsWarning]
|
||||
,[TestSetup]
|
||||
from [dbo].[TestSetups]
|
||||
where ((@TestSetupId is null or @TestSetupId= 0) or TestSetupId = @TestSetupId)
|
||||
and (@TestSetupName is null or TestSetupName = @TestSetupName)
|
||||
END
|
||||
|
||||
|
||||
@@ -0,0 +1,255 @@
|
||||
|
||||
ALTER PROCEDURE [dbo].[sp_TestSetupsInsert]
|
||||
@TestSetupName nvarchar(50) = Null
|
||||
,@SetupDescription nvarchar(50)
|
||||
,@AutomaticTestProgression bit
|
||||
,@AutomaticProgressionDelayMS int
|
||||
,@InvertTrigger bit
|
||||
,@InvertStart bit
|
||||
,@ViewDiagnostics bit
|
||||
,@VerifyChannels bit
|
||||
,@AutoVerifyChannels bit
|
||||
,@VerifyChannelsDelayMS int
|
||||
,@RecordingMode smallint
|
||||
,@SamplesPerSecond float
|
||||
,@PreTriggerSeconds float
|
||||
,@PostTriggerSeconds float
|
||||
,@StrictDiagnostics bit
|
||||
,@RequireConfirmationOnErrors bit
|
||||
,@ROIDownload bit
|
||||
,@ViewROIDownload bit
|
||||
,@DownloadAll bit
|
||||
,@ViewRealtime bit
|
||||
,@RealtimePlotCount smallint
|
||||
,@RegionsOfInterest nvarchar(MAX)
|
||||
,@ROIStart float
|
||||
,@ROIEnd float
|
||||
,@ViewDownloadAll bit
|
||||
,@Export bit
|
||||
,@ExportFormat bigint
|
||||
,@LabDetails nvarchar(50)
|
||||
,@UseLabDetails bit
|
||||
,@CustomerDetails nvarchar(50)
|
||||
,@UseCustomerDetails bit
|
||||
,@AllowMissingSensors bit
|
||||
,@AllowSensorIdToBlankChannel bit
|
||||
,@CalibrationBehavior smallint
|
||||
,@LocalOnly bit
|
||||
,@LastModified datetime
|
||||
,@LastModifiedBy nvarchar(50)
|
||||
,@TurnOffExcitation bit
|
||||
,@TriggerCheckRealtime bit
|
||||
,@TriggerCheckStep bit
|
||||
,@PostTestDiagnostics int
|
||||
,@ExportFolder nvarchar(150)
|
||||
,@DownloadFolder nvarchar(150)
|
||||
,@CommonStatusLine bit
|
||||
,@SameAsDownloadFolder bit
|
||||
,@UploadData bit
|
||||
,@UploadDataFolder nvarchar(150)
|
||||
,@UploadExportsOnly bit
|
||||
,@Settings nvarchar(4000)
|
||||
,@WarnOnBatteryFail bit
|
||||
,@Dirty bit
|
||||
,@Complete bit
|
||||
,@Error nvarchar(255)
|
||||
,@TestEngineerDetails nvarchar(50)
|
||||
,@UseTestEngineerDetails bit
|
||||
,@UserTags varbinary(max)
|
||||
,@DoAutoArm bit
|
||||
,@CheckoutMode bit
|
||||
,@ISFFile nvarchar(4000)
|
||||
,@QuitTestWithoutWarning bit
|
||||
,@NotAllChannelsRealTime bit
|
||||
,@NotAllChannelsViewer bit
|
||||
,@SuppressMissingSensorsWarning bit
|
||||
,@TestSetup varbinary(MAX)
|
||||
,@new_id int output
|
||||
,@errorNumber int output
|
||||
,@errorMessage nvarchar(250) output
|
||||
AS
|
||||
BEGIN
|
||||
set @errorNumber = 0; set @errorMessage = space(0);
|
||||
|
||||
/* Table (and stored procedure) is too big... */
|
||||
begin try
|
||||
if(@TestSetupName is null)
|
||||
begin
|
||||
set @errorMessage = 'An invalid parameter or option was specified for procedure'
|
||||
set @errorNumber = 15600
|
||||
end
|
||||
else
|
||||
begin
|
||||
SET NOCOUNT ON;
|
||||
declare @TestEngineerId int
|
||||
declare @LabratoryId int
|
||||
declare @CustomerId int
|
||||
|
||||
set @CustomerId = dbo.foo_IdGetCustomer(@CustomerDetails)
|
||||
IF @CustomerId <= 0
|
||||
BEGIN
|
||||
SET @CustomerId = null
|
||||
END
|
||||
set @LabratoryId = dbo.foo_IdGetLabratory(@LabDetails)
|
||||
IF @LabratoryId <= 0
|
||||
BEGIN
|
||||
SET @LabratoryId = null
|
||||
END
|
||||
set @TestEngineerId = dbo.foo_IdGetEngineer(@TestEngineerDetails);
|
||||
IF @TestEngineerId <= 0
|
||||
BEGIN
|
||||
SET @TestEngineerId = null
|
||||
END
|
||||
|
||||
insert into [dbo].[TestSetups]
|
||||
([TestSetupName]
|
||||
,[SetupDescription]
|
||||
,[AutomaticTestProgression]
|
||||
,[AutomaticProgressionDelayMS]
|
||||
,[InvertTrigger]
|
||||
,[InvertStart]
|
||||
,[ViewDiagnostics]
|
||||
,[VerifyChannels]
|
||||
,[AutoVerifyChannels]
|
||||
,[VerifyChannelsDelayMS]
|
||||
,[RecordingMode]
|
||||
,[SamplesPerSecond]
|
||||
,[PreTriggerSeconds]
|
||||
,[PostTriggerSeconds]
|
||||
,[StrictDiagnostics]
|
||||
,[RequireConfirmationOnErrors]
|
||||
,[ROIDownload]
|
||||
,[ViewROIDownload]
|
||||
,[DownloadAll]
|
||||
,[ViewRealtime]
|
||||
,[RealtimePlotCount]
|
||||
,[RegionsOfInterest]
|
||||
,[ROIStart]
|
||||
,[ROIEnd]
|
||||
,[ViewDownloadAll]
|
||||
,[Export]
|
||||
,[ExportFormat]
|
||||
|
||||
,[CustomerId]
|
||||
,[LabratoryId]
|
||||
,[TestEngineerId]
|
||||
,[LabDetails]
|
||||
,[UseLabDetails]
|
||||
,[CustomerDetails]
|
||||
,[UseCustomerDetails]
|
||||
,[TestEngineerDetails]
|
||||
,[UseTestEngineerDetails]
|
||||
|
||||
,[AllowMissingSensors]
|
||||
,[AllowSensorIdToBlankChannel]
|
||||
,[CalibrationBehavior]
|
||||
,[LocalOnly]
|
||||
,[LastModified]
|
||||
,[LastModifiedBy]
|
||||
,[TurnOffExcitation]
|
||||
,[TriggerCheckRealtime]
|
||||
,[TriggerCheckStep]
|
||||
,[PostTestDiagnostics]
|
||||
,[ExportFolder]
|
||||
,[DownloadFolder]
|
||||
,[CommonStatusLine]
|
||||
,[SameAsDownloadFolder]
|
||||
,[UploadData]
|
||||
,[UploadDataFolder]
|
||||
,[UploadExportsOnly]
|
||||
,[Settings]
|
||||
,[WarnOnBatteryFail]
|
||||
,[Dirty]
|
||||
,[Complete]
|
||||
,[ErrorMessage]
|
||||
,[UserTags]
|
||||
,[DoAutoArm]
|
||||
,[CheckoutMode]
|
||||
,[ISFFile]
|
||||
,[QuitTestWithoutWarning]
|
||||
,[NotAllChannelsRealTime]
|
||||
,[NotAllChannelsViewer]
|
||||
,[SuppressMissingSensorsWarning]
|
||||
,[TestSetup])
|
||||
VALUES
|
||||
( @TestSetupName
|
||||
,@SetupDescription
|
||||
,@AutomaticTestProgression
|
||||
,@AutomaticProgressionDelayMS
|
||||
,@InvertTrigger
|
||||
,@InvertStart
|
||||
,@ViewDiagnostics
|
||||
,@VerifyChannels
|
||||
,@AutoVerifyChannels
|
||||
,@VerifyChannelsDelayMS
|
||||
,@RecordingMode
|
||||
,@SamplesPerSecond
|
||||
,@PreTriggerSeconds
|
||||
,@PostTriggerSeconds
|
||||
,@StrictDiagnostics
|
||||
,@RequireConfirmationOnErrors
|
||||
,@ROIDownload
|
||||
,@ViewROIDownload
|
||||
,@DownloadAll
|
||||
,@ViewRealtime
|
||||
,@RealtimePlotCount
|
||||
,@RegionsOfInterest
|
||||
,@ROIStart
|
||||
,@ROIEnd
|
||||
,@ViewDownloadAll
|
||||
,@Export
|
||||
,@ExportFormat
|
||||
|
||||
,@CustomerId
|
||||
,@LabratoryId
|
||||
,@TestEngineerId
|
||||
,@LabDetails
|
||||
,@UseLabDetails
|
||||
,@CustomerDetails
|
||||
,@UseCustomerDetails
|
||||
,@TestEngineerDetails
|
||||
,@UseTestEngineerDetails
|
||||
|
||||
,@AllowMissingSensors
|
||||
,@AllowSensorIdToBlankChannel
|
||||
,@CalibrationBehavior
|
||||
,@LocalOnly
|
||||
,@LastModified
|
||||
,@LastModifiedBy
|
||||
,@TurnOffExcitation
|
||||
,@TriggerCheckRealtime
|
||||
,@TriggerCheckStep
|
||||
,@PostTestDiagnostics
|
||||
,@ExportFolder
|
||||
,@DownloadFolder
|
||||
,@CommonStatusLine
|
||||
,@SameAsDownloadFolder
|
||||
,@UploadData
|
||||
,@UploadDataFolder
|
||||
,@UploadExportsOnly
|
||||
,@Settings
|
||||
,@WarnOnBatteryFail
|
||||
,@Dirty
|
||||
,@Complete
|
||||
,@Error
|
||||
|
||||
,@UserTags
|
||||
,@DoAutoArm
|
||||
,@CheckoutMode
|
||||
,@ISFFile
|
||||
,@QuitTestWithoutWarning
|
||||
,@NotAllChannelsRealTime
|
||||
,@NotAllChannelsViewer
|
||||
,@SuppressMissingSensorsWarning
|
||||
,@TestSetup)
|
||||
|
||||
set @new_id = scope_identity()
|
||||
end
|
||||
end try
|
||||
begin catch
|
||||
set @errorMessage = error_message()
|
||||
set @errorNumber = error_number()
|
||||
end catch;
|
||||
|
||||
END
|
||||
|
||||
@@ -0,0 +1,218 @@
|
||||
|
||||
ALTER PROCEDURE [dbo].[sp_TestSetupsInsertUpdate]
|
||||
@TestSetupName nvarchar(50) = Null
|
||||
,@SetupDescription nvarchar(50)
|
||||
,@AutomaticTestProgression bit
|
||||
,@AutomaticProgressionDelayMS int
|
||||
,@InvertTrigger bit
|
||||
,@InvertStart bit
|
||||
,@ViewDiagnostics bit
|
||||
,@VerifyChannels bit
|
||||
,@AutoVerifyChannels bit
|
||||
,@VerifyChannelsDelayMS int
|
||||
,@RecordingMode smallint
|
||||
,@SamplesPerSecond float
|
||||
,@PreTriggerSeconds float
|
||||
,@PostTriggerSeconds float
|
||||
,@StrictDiagnostics bit
|
||||
,@RequireConfirmationOnErrors bit
|
||||
,@ROIDownload bit
|
||||
,@ViewROIDownload bit
|
||||
,@DownloadAll bit
|
||||
,@ViewRealtime bit
|
||||
,@RealtimePlotCount smallint
|
||||
,@RegionsOfInterest nvarchar(MAX)
|
||||
,@ROIStart float
|
||||
,@ROIEnd float
|
||||
,@ViewDownloadAll bit
|
||||
,@Export bit
|
||||
,@ExportFormat bigint
|
||||
,@LabDetails nvarchar(50)
|
||||
,@UseLabDetails bit
|
||||
,@CustomerDetails nvarchar(50)
|
||||
,@UseCustomerDetails bit
|
||||
,@AllowMissingSensors bit
|
||||
,@AllowSensorIdToBlankChannel bit
|
||||
,@CalibrationBehavior smallint
|
||||
,@LocalOnly bit
|
||||
,@LastModified datetime
|
||||
,@LastModifiedBy nvarchar(50)
|
||||
,@TurnOffExcitation bit
|
||||
,@TriggerCheckRealtime bit
|
||||
,@TriggerCheckStep bit
|
||||
,@PostTestDiagnostics int
|
||||
,@ExportFolder nvarchar(150)
|
||||
,@DownloadFolder nvarchar(150)
|
||||
,@CommonStatusLine bit
|
||||
,@SameAsDownloadFolder bit
|
||||
,@UploadData bit
|
||||
,@UploadDataFolder nvarchar(150)
|
||||
,@UploadExportsOnly bit
|
||||
,@Settings nvarchar(4000)
|
||||
,@WarnOnBatteryFail bit
|
||||
,@Dirty bit
|
||||
,@Complete bit
|
||||
,@Error nvarchar(255)
|
||||
,@TestEngineerDetails nvarchar(50)
|
||||
,@UseTestEngineerDetails bit
|
||||
,@UserTags varbinary(max)
|
||||
,@DoAutoArm bit
|
||||
,@CheckoutMode bit
|
||||
,@ISFFile nvarchar(4000)
|
||||
,@QuitTestWithoutWarning bit
|
||||
,@NotAllChannelsRealTime bit
|
||||
,@NotAllChannelsViewer bit
|
||||
,@SuppressMissingSensorsWarning bit
|
||||
,@TestSetup varbinary(MAX)
|
||||
,@new_id int output
|
||||
,@errorNumber int output
|
||||
,@errorMessage nvarchar(250) output
|
||||
AS
|
||||
BEGIN
|
||||
set @errorNumber = 0; set @errorMessage = space(0);
|
||||
declare @TestSetupId int
|
||||
|
||||
set @TestSetupId = dbo.foo_IdGetTestSetup(@TestSetupName)
|
||||
|
||||
if(exists(select TestSetupId from [dbo].[TestSetups] where TestSetupId = @TestSetupId))
|
||||
begin
|
||||
set @new_id = @TestSetupId
|
||||
exec dbo.sp_TestSetupsUpdate @TestSetupName
|
||||
,@SetupDescription
|
||||
,@AutomaticTestProgression
|
||||
,@AutomaticProgressionDelayMS
|
||||
,@InvertTrigger
|
||||
,@InvertStart
|
||||
,@ViewDiagnostics
|
||||
,@VerifyChannels
|
||||
,@AutoVerifyChannels
|
||||
,@VerifyChannelsDelayMS
|
||||
,@RecordingMode
|
||||
,@SamplesPerSecond
|
||||
,@PreTriggerSeconds
|
||||
,@PostTriggerSeconds
|
||||
,@StrictDiagnostics
|
||||
,@RequireConfirmationOnErrors
|
||||
,@ROIDownload
|
||||
,@ViewROIDownload
|
||||
,@DownloadAll
|
||||
,@ViewRealtime
|
||||
,@RealtimePlotCount
|
||||
,@RegionsOfInterest
|
||||
,@ROIStart
|
||||
,@ROIEnd
|
||||
,@ViewDownloadAll
|
||||
,@Export
|
||||
,@ExportFormat
|
||||
,@LabDetails
|
||||
,@UseLabDetails
|
||||
,@CustomerDetails
|
||||
,@UseCustomerDetails
|
||||
,@AllowMissingSensors
|
||||
,@AllowSensorIdToBlankChannel
|
||||
,@CalibrationBehavior
|
||||
,@LocalOnly
|
||||
,@LastModified
|
||||
,@LastModifiedBy
|
||||
,@TurnOffExcitation
|
||||
,@TriggerCheckRealtime
|
||||
,@TriggerCheckStep
|
||||
,@PostTestDiagnostics
|
||||
,@ExportFolder
|
||||
,@DownloadFolder
|
||||
,@CommonStatusLine
|
||||
,@SameAsDownloadFolder
|
||||
,@UploadData
|
||||
,@UploadDataFolder
|
||||
,@UploadExportsOnly
|
||||
,@Settings
|
||||
,@WarnOnBatteryFail
|
||||
,@Dirty
|
||||
,@Complete
|
||||
,@Error
|
||||
,@TestEngineerDetails
|
||||
,@UseTestEngineerDetails
|
||||
,@UserTags
|
||||
,@DoAutoArm
|
||||
,@CheckoutMode
|
||||
,@ISFFile
|
||||
,@QuitTestWithoutWarning
|
||||
,@NotAllChannelsRealTime
|
||||
,@NotAllChannelsViewer
|
||||
,@SuppressMissingSensorsWarning
|
||||
,@TestSetup
|
||||
,@new_id output
|
||||
,@errorNumber output
|
||||
,@errorMessage output
|
||||
end
|
||||
else
|
||||
begin
|
||||
exec dbo.sp_TestSetupsInsert @TestSetupName
|
||||
,@SetupDescription
|
||||
,@AutomaticTestProgression
|
||||
,@AutomaticProgressionDelayMS
|
||||
,@InvertTrigger
|
||||
,@InvertStart
|
||||
,@ViewDiagnostics
|
||||
,@VerifyChannels
|
||||
,@AutoVerifyChannels
|
||||
,@VerifyChannelsDelayMS
|
||||
,@RecordingMode
|
||||
,@SamplesPerSecond
|
||||
,@PreTriggerSeconds
|
||||
,@PostTriggerSeconds
|
||||
,@StrictDiagnostics
|
||||
,@RequireConfirmationOnErrors
|
||||
,@ROIDownload
|
||||
,@ViewROIDownload
|
||||
,@DownloadAll
|
||||
,@ViewRealtime
|
||||
,@RealtimePlotCount
|
||||
,@RegionsOfInterest
|
||||
,@ROIStart
|
||||
,@ROIEnd
|
||||
,@ViewDownloadAll
|
||||
,@Export
|
||||
,@ExportFormat
|
||||
,@LabDetails
|
||||
,@UseLabDetails
|
||||
,@CustomerDetails
|
||||
,@UseCustomerDetails
|
||||
,@AllowMissingSensors
|
||||
,@AllowSensorIdToBlankChannel
|
||||
,@CalibrationBehavior
|
||||
,@LocalOnly
|
||||
,@LastModified
|
||||
,@LastModifiedBy
|
||||
,@TurnOffExcitation
|
||||
,@TriggerCheckRealtime
|
||||
,@TriggerCheckStep
|
||||
,@PostTestDiagnostics
|
||||
,@ExportFolder
|
||||
,@DownloadFolder
|
||||
,@CommonStatusLine
|
||||
,@SameAsDownloadFolder
|
||||
,@UploadData
|
||||
,@UploadDataFolder
|
||||
,@UploadExportsOnly
|
||||
,@Settings
|
||||
,@WarnOnBatteryFail
|
||||
,@Dirty
|
||||
,@Complete
|
||||
,@Error
|
||||
,@TestEngineerDetails
|
||||
,@UseTestEngineerDetails
|
||||
,@UserTags
|
||||
,@DoAutoArm
|
||||
,@CheckoutMode
|
||||
,@ISFFile
|
||||
,@QuitTestWithoutWarning
|
||||
,@NotAllChannelsRealTime
|
||||
,@NotAllChannelsViewer
|
||||
,@SuppressMissingSensorsWarning
|
||||
,@TestSetup
|
||||
,@new_id output
|
||||
,@errorNumber output
|
||||
,@errorMessage output
|
||||
end
|
||||
END
|
||||
@@ -0,0 +1,183 @@
|
||||
|
||||
ALTER PROCEDURE [dbo].[sp_TestSetupsUpdate]
|
||||
@TestSetupName nvarchar(50) = Null
|
||||
,@SetupDescription nvarchar(50)
|
||||
,@AutomaticTestProgression bit
|
||||
,@AutomaticProgressionDelayMS int
|
||||
,@InvertTrigger bit
|
||||
,@InvertStart bit
|
||||
,@ViewDiagnostics bit
|
||||
,@VerifyChannels bit
|
||||
,@AutoVerifyChannels bit
|
||||
,@VerifyChannelsDelayMS int
|
||||
,@RecordingMode smallint
|
||||
,@SamplesPerSecond float
|
||||
,@PreTriggerSeconds float
|
||||
,@PostTriggerSeconds float
|
||||
,@StrictDiagnostics bit
|
||||
,@RequireConfirmationOnErrors bit
|
||||
,@ROIDownload bit
|
||||
,@ViewROIDownload bit
|
||||
,@DownloadAll bit
|
||||
,@ViewRealtime bit
|
||||
,@RealtimePlotCount smallint
|
||||
,@RegionsOfInterest nvarchar(MAX)
|
||||
,@ROIStart float
|
||||
,@ROIEnd float
|
||||
,@ViewDownloadAll bit
|
||||
,@Export bit
|
||||
,@ExportFormat bigint
|
||||
,@LabDetails nvarchar(50)
|
||||
,@UseLabDetails bit
|
||||
,@CustomerDetails nvarchar(50)
|
||||
,@UseCustomerDetails bit
|
||||
,@AllowMissingSensors bit
|
||||
,@AllowSensorIdToBlankChannel bit
|
||||
,@CalibrationBehavior smallint
|
||||
,@LocalOnly bit
|
||||
,@LastModified datetime
|
||||
,@LastModifiedBy nvarchar(50)
|
||||
,@TurnOffExcitation bit
|
||||
,@TriggerCheckRealtime bit
|
||||
,@TriggerCheckStep bit
|
||||
,@PostTestDiagnostics int
|
||||
,@ExportFolder nvarchar(150)
|
||||
,@DownloadFolder nvarchar(150)
|
||||
,@CommonStatusLine bit
|
||||
,@SameAsDownloadFolder bit
|
||||
,@UploadData bit
|
||||
,@UploadDataFolder nvarchar(150)
|
||||
,@UploadExportsOnly bit
|
||||
,@Settings nvarchar(4000)
|
||||
,@WarnOnBatteryFail bit
|
||||
,@Dirty bit
|
||||
,@Complete bit
|
||||
,@Error nvarchar(255)
|
||||
,@TestEngineerDetails nvarchar(50)
|
||||
,@UseTestEngineerDetails bit
|
||||
,@UserTags varbinary(max)
|
||||
,@DoAutoArm bit
|
||||
,@CheckoutMode bit
|
||||
,@ISFFile nvarchar(4000)
|
||||
,@QuitTestWithoutWarning bit
|
||||
,@NotAllChannelsRealTime bit
|
||||
,@NotAllChannelsViewer bit
|
||||
,@SuppressMissingSensorsWarning bit
|
||||
,@TestSetup varbinary(MAX)
|
||||
,@new_id int output
|
||||
,@errorNumber int output
|
||||
,@errorMessage nvarchar(250) output
|
||||
|
||||
AS
|
||||
BEGIN
|
||||
set @errorNumber = 0; set @errorMessage = space(0); set @new_id = 0;
|
||||
|
||||
/* Table (ans stored procedure) is too big... */
|
||||
|
||||
begin try
|
||||
if(@TestSetupName is null)
|
||||
begin
|
||||
set @errorMessage = 'An invalid parameter or option was specified for procedure'
|
||||
set @errorNumber = 15600
|
||||
end
|
||||
else
|
||||
begin
|
||||
|
||||
declare @TestSetupId int
|
||||
declare @TestEngineerId int
|
||||
declare @LabratoryId int
|
||||
declare @CustomerId int
|
||||
|
||||
set @TestSetupId = dbo.foo_IdGetTestSetup(@TestSetupName)
|
||||
set @CustomerId = dbo.foo_IdGetCustomer(@CustomerDetails)
|
||||
IF @CustomerId <= 0
|
||||
BEGIN
|
||||
SET @CustomerId = null
|
||||
END
|
||||
set @LabratoryId = dbo.foo_IdGetLabratory(@LabDetails)
|
||||
IF @LabratoryId <= 0
|
||||
BEGIN
|
||||
SET @LabratoryId = null
|
||||
END
|
||||
set @TestEngineerId = dbo.foo_IdGetEngineer(@TestEngineerDetails);
|
||||
BEGIN
|
||||
SET @TestEngineerId = null
|
||||
END
|
||||
|
||||
set @new_id = @TestSetupId
|
||||
|
||||
UPDATE [dbo].[TestSetups]
|
||||
SET [SetupDescription] = @SetupDescription
|
||||
,[AutomaticTestProgression] = @AutomaticTestProgression
|
||||
,[AutomaticProgressionDelayMS] = @AutomaticProgressionDelayMS
|
||||
,[InvertTrigger] = @InvertTrigger
|
||||
,[InvertStart] = @InvertStart
|
||||
,[ViewDiagnostics] = @ViewDiagnostics
|
||||
,[VerifyChannels] = @VerifyChannels
|
||||
,[AutoVerifyChannels] = @AutoVerifyChannels
|
||||
,[VerifyChannelsDelayMS] = @VerifyChannelsDelayMS
|
||||
,[RecordingMode] = @RecordingMode
|
||||
,[SamplesPerSecond] = @SamplesPerSecond
|
||||
,[PreTriggerSeconds] = @PreTriggerSeconds
|
||||
,[PostTriggerSeconds] = @PostTriggerSeconds
|
||||
,[StrictDiagnostics] = @StrictDiagnostics
|
||||
,[RequireConfirmationOnErrors] = @RequireConfirmationOnErrors
|
||||
,[ROIDownload] = @ROIDownload
|
||||
,[ViewROIDownload] = @ViewROIDownload
|
||||
,[DownloadAll] = @DownloadAll
|
||||
,[ViewRealtime] = @ViewRealtime
|
||||
,[RealtimePlotCount] = @RealtimePlotCount
|
||||
,[RegionsOfInterest] = @RegionsOfInterest
|
||||
,[ROIStart] = @ROIStart
|
||||
,[ROIEnd] = @ROIEnd
|
||||
,[ViewDownloadAll] = @ViewDownloadAll
|
||||
,[Export] = @Export
|
||||
,[ExportFormat] = @ExportFormat
|
||||
,[CustomerId] = @CustomerId
|
||||
,[LabratoryId] = @LabratoryId
|
||||
,[TestEngineerId] = @TestEngineerId
|
||||
,[LabDetails] = @LabDetails
|
||||
,[UseLabDetails] = @UseLabDetails
|
||||
,[CustomerDetails] = @CustomerDetails
|
||||
,[UseCustomerDetails] = @UseCustomerDetails
|
||||
,[AllowMissingSensors] = @AllowMissingSensors
|
||||
,[AllowSensorIdToBlankChannel] = @AllowSensorIdToBlankChannel
|
||||
,[CalibrationBehavior] = @CalibrationBehavior
|
||||
,[LocalOnly] = @LocalOnly
|
||||
,[LastModified] = @LastModified
|
||||
,[LastModifiedBy] = @LastModifiedBy
|
||||
,[TurnOffExcitation] = @TurnOffExcitation
|
||||
,[TriggerCheckRealtime] = @TriggerCheckRealtime
|
||||
,[TriggerCheckStep] = @TriggerCheckStep
|
||||
,[PostTestDiagnostics] = @PostTestDiagnostics
|
||||
,[ExportFolder] = @ExportFolder
|
||||
,[DownloadFolder] = @DownloadFolder
|
||||
,[CommonStatusLine] = @CommonStatusLine
|
||||
,[SameAsDownloadFolder] = @SameAsDownloadFolder
|
||||
,[UploadData] = @UploadData
|
||||
,[UploadDataFolder] = @UploadDataFolder
|
||||
,[UploadExportsOnly] = @UploadExportsOnly
|
||||
,[Settings] = @Settings
|
||||
,[WarnOnBatteryFail] = @WarnOnBatteryFail
|
||||
,[Dirty] = @Dirty
|
||||
,[Complete] = @Complete
|
||||
,[ErrorMessage] = @Error
|
||||
,[TestEngineerDetails] = @TestEngineerDetails
|
||||
,[UseTestEngineerDetails] = @UseTestEngineerDetails
|
||||
,[UserTags] = @UserTags
|
||||
,[DoAutoArm] = @DoAutoArm
|
||||
,[CheckoutMode] = @CheckoutMode
|
||||
,[ISFFile] = @ISFFile
|
||||
,[QuitTestWithoutWarning] = @QuitTestWithoutWarning
|
||||
,[NotAllChannelsRealTime] = @NotAllChannelsRealTime
|
||||
,[NotAllChannelsViewer] = @NotAllChannelsViewer
|
||||
,[SuppressMissingSensorsWarning] = @SuppressMissingSensorsWarning
|
||||
,[TestSetup] = @TestSetup
|
||||
WHERE [TestSetupId] = @TestSetupId
|
||||
end
|
||||
end try
|
||||
begin catch
|
||||
set @errorMessage = error_message()
|
||||
set @errorNumber = error_number()
|
||||
end catch;
|
||||
END
|
||||
@@ -0,0 +1,219 @@
|
||||
|
||||
ALTER PROCEDURE [dbo].[sp_TestSetupsUpdateInsert]
|
||||
@TestSetupName nvarchar(50) = Null
|
||||
,@SetupDescription nvarchar(50)
|
||||
,@AutomaticTestProgression bit
|
||||
,@AutomaticProgressionDelayMS int
|
||||
,@InvertTrigger bit
|
||||
,@InvertStart bit
|
||||
,@ViewDiagnostics bit
|
||||
,@VerifyChannels bit
|
||||
,@AutoVerifyChannels bit
|
||||
,@VerifyChannelsDelayMS int
|
||||
,@RecordingMode smallint
|
||||
,@SamplesPerSecond float
|
||||
,@PreTriggerSeconds float
|
||||
,@PostTriggerSeconds float
|
||||
,@StrictDiagnostics bit
|
||||
,@RequireConfirmationOnErrors bit
|
||||
,@ROIDownload bit
|
||||
,@ViewROIDownload bit
|
||||
,@DownloadAll bit
|
||||
,@ViewRealtime bit
|
||||
,@RealtimePlotCount smallint
|
||||
,@RegionsOfInterest nvarchar(MAX)
|
||||
,@ROIStart float
|
||||
,@ROIEnd float
|
||||
,@ViewDownloadAll bit
|
||||
,@Export bit
|
||||
,@ExportFormat bigint
|
||||
,@LabDetails nvarchar(50)
|
||||
,@UseLabDetails bit
|
||||
,@CustomerDetails nvarchar(50)
|
||||
,@UseCustomerDetails bit
|
||||
,@AllowMissingSensors bit
|
||||
,@AllowSensorIdToBlankChannel bit
|
||||
,@CalibrationBehavior smallint
|
||||
,@LocalOnly bit
|
||||
,@LastModified datetime
|
||||
,@LastModifiedBy nvarchar(50)
|
||||
,@TurnOffExcitation bit
|
||||
,@TriggerCheckRealtime bit
|
||||
,@TriggerCheckStep bit
|
||||
,@PostTestDiagnostics int
|
||||
,@ExportFolder nvarchar(150)
|
||||
,@DownloadFolder nvarchar(150)
|
||||
,@CommonStatusLine bit
|
||||
,@SameAsDownloadFolder bit
|
||||
,@UploadData bit
|
||||
,@UploadDataFolder nvarchar(150)
|
||||
,@UploadExportsOnly bit
|
||||
,@Settings nvarchar(4000)
|
||||
,@WarnOnBatteryFail bit
|
||||
,@Dirty bit
|
||||
,@Complete bit
|
||||
,@Error nvarchar(255)
|
||||
,@TestEngineerDetails nvarchar(50)
|
||||
,@UseTestEngineerDetails bit
|
||||
,@UserTags varbinary(max)
|
||||
,@DoAutoArm bit
|
||||
,@CheckoutMode bit
|
||||
,@ISFFile nvarchar(4000)
|
||||
,@QuitTestWithoutWarning bit
|
||||
,@NotAllChannelsRealTime bit
|
||||
,@NotAllChannelsViewer bit
|
||||
,@SuppressMissingSensorsWarning bit
|
||||
,@TestSetup varbinary(MAX)
|
||||
,@new_id int output
|
||||
,@errorNumber int output
|
||||
,@errorMessage nvarchar(250) output
|
||||
AS
|
||||
BEGIN
|
||||
set @errorNumber = 0; set @errorMessage = space(0);
|
||||
declare @TestSetupId int
|
||||
|
||||
set @TestSetupId = dbo.foo_IdGetTestSetup(@TestSetupName)
|
||||
|
||||
if(exists(select TestSetupId from [dbo].[TestSetups] where TestSetupId = @TestSetupId))
|
||||
begin
|
||||
set @new_id = @TestSetupId
|
||||
exec dbo.sp_TestSetupsUpdate @TestSetupName
|
||||
,@SetupDescription
|
||||
,@AutomaticTestProgression
|
||||
,@AutomaticProgressionDelayMS
|
||||
,@InvertTrigger
|
||||
,@InvertStart
|
||||
,@ViewDiagnostics
|
||||
,@VerifyChannels
|
||||
,@AutoVerifyChannels
|
||||
,@VerifyChannelsDelayMS
|
||||
,@RecordingMode
|
||||
,@SamplesPerSecond
|
||||
,@PreTriggerSeconds
|
||||
,@PostTriggerSeconds
|
||||
,@StrictDiagnostics
|
||||
,@RequireConfirmationOnErrors
|
||||
,@ROIDownload
|
||||
,@ViewROIDownload
|
||||
,@DownloadAll
|
||||
,@ViewRealtime
|
||||
,@RealtimePlotCount
|
||||
,@RegionsOfInterest
|
||||
,@ROIStart
|
||||
,@ROIEnd
|
||||
,@ViewDownloadAll
|
||||
,@Export
|
||||
,@ExportFormat
|
||||
,@LabDetails
|
||||
,@UseLabDetails
|
||||
,@CustomerDetails
|
||||
,@UseCustomerDetails
|
||||
,@AllowMissingSensors
|
||||
,@AllowSensorIdToBlankChannel
|
||||
,@CalibrationBehavior
|
||||
,@LocalOnly
|
||||
,@LastModified
|
||||
,@LastModifiedBy
|
||||
,@TurnOffExcitation
|
||||
,@TriggerCheckRealtime
|
||||
,@TriggerCheckStep
|
||||
,@PostTestDiagnostics
|
||||
,@ExportFolder
|
||||
,@DownloadFolder
|
||||
,@CommonStatusLine
|
||||
,@SameAsDownloadFolder
|
||||
,@UploadData
|
||||
,@UploadDataFolder
|
||||
,@UploadExportsOnly
|
||||
,@Settings
|
||||
,@WarnOnBatteryFail
|
||||
,@Dirty
|
||||
,@Complete
|
||||
,@Error
|
||||
,@TestEngineerDetails
|
||||
,@UseTestEngineerDetails
|
||||
,@UserTags
|
||||
,@DoAutoArm
|
||||
,@CheckoutMode
|
||||
,@ISFFile
|
||||
,@QuitTestWithoutWarning
|
||||
,@NotAllChannelsRealTime
|
||||
,@NotAllChannelsViewer
|
||||
,@SuppressMissingSensorsWarning
|
||||
,@TestSetup
|
||||
,@new_id output
|
||||
,@errorNumber output
|
||||
,@errorMessage output
|
||||
end
|
||||
else
|
||||
begin
|
||||
exec dbo.sp_TestSetupsInsert @TestSetupName
|
||||
,@SetupDescription
|
||||
,@AutomaticTestProgression
|
||||
,@AutomaticProgressionDelayMS
|
||||
,@InvertTrigger
|
||||
,@InvertStart
|
||||
,@ViewDiagnostics
|
||||
,@VerifyChannels
|
||||
,@AutoVerifyChannels
|
||||
,@VerifyChannelsDelayMS
|
||||
,@RecordingMode
|
||||
,@SamplesPerSecond
|
||||
,@PreTriggerSeconds
|
||||
,@PostTriggerSeconds
|
||||
,@StrictDiagnostics
|
||||
,@RequireConfirmationOnErrors
|
||||
,@ROIDownload
|
||||
,@ViewROIDownload
|
||||
,@DownloadAll
|
||||
,@ViewRealtime
|
||||
,@RealtimePlotCount
|
||||
,@RegionsOfInterest
|
||||
,@ROIStart
|
||||
,@ROIEnd
|
||||
,@ViewDownloadAll
|
||||
,@Export
|
||||
,@ExportFormat
|
||||
,@LabDetails
|
||||
,@UseLabDetails
|
||||
,@CustomerDetails
|
||||
,@UseCustomerDetails
|
||||
,@AllowMissingSensors
|
||||
,@AllowSensorIdToBlankChannel
|
||||
,@CalibrationBehavior
|
||||
,@LocalOnly
|
||||
,@LastModified
|
||||
,@LastModifiedBy
|
||||
,@TurnOffExcitation
|
||||
,@TriggerCheckRealtime
|
||||
,@TriggerCheckStep
|
||||
,@PostTestDiagnostics
|
||||
,@ExportFolder
|
||||
,@DownloadFolder
|
||||
,@CommonStatusLine
|
||||
,@SameAsDownloadFolder
|
||||
,@UploadData
|
||||
,@UploadDataFolder
|
||||
,@UploadExportsOnly
|
||||
,@Settings
|
||||
,@WarnOnBatteryFail
|
||||
,@Dirty
|
||||
,@Complete
|
||||
,@Error
|
||||
,@TestEngineerDetails
|
||||
,@UseTestEngineerDetails
|
||||
,@UserTags
|
||||
,@DoAutoArm
|
||||
,@CheckoutMode
|
||||
,@ISFFile
|
||||
,@QuitTestWithoutWarning
|
||||
,@NotAllChannelsRealTime
|
||||
,@NotAllChannelsViewer
|
||||
,@SuppressMissingSensorsWarning
|
||||
,@TestSetup
|
||||
,@new_id output
|
||||
,@errorNumber output
|
||||
,@errorMessage output
|
||||
end
|
||||
END
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
INSERT INTO [dbo].[DefaultProperties]
|
||||
([PropertyId]
|
||||
,[PropertyName]
|
||||
,[DefaultValue])
|
||||
VALUES
|
||||
(306
|
||||
,'DefaultSensorCalibrationBehavior'
|
||||
,'NonLinearIfAvailable')
|
||||
|
||||
UPDATE dbo.TestSetups SET CalibrationBehavior = 1
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
CREATE FUNCTION [dbo].[foo_GetIdenticalChannelCount]
|
||||
(
|
||||
@GroupId1 int,
|
||||
@GroupId2 int
|
||||
)
|
||||
RETURNS int
|
||||
AS
|
||||
BEGIN
|
||||
return (
|
||||
SELECT COUNT(*)
|
||||
FROM [DataPro].[dbo].[Channels] C1,
|
||||
[DataPro].[dbo].[Channels] C2
|
||||
WHERE C1.GroupId = @GroupId1
|
||||
AND C2.GroupId = @GroupId2
|
||||
AND ((C1.SensorId IS NULL AND C2.SensorId IS NULL) OR (C1.SensorId = C2.SensorId))
|
||||
AND C1.IsoCode = C2.IsoCode
|
||||
AND C1.IsoChannelName = C2.IsoChannelName
|
||||
AND C1.UserCode = C2.UserCode
|
||||
AND C1.UserChannelName = C2.UserChannelName
|
||||
AND ((C1.DASId IS NULL AND C2.DASId IS NULL) OR (C1.DASId = C2.DASId))
|
||||
AND C1.DASChannelIndex = C2.DASChannelIndex
|
||||
AND C1.GroupChannelOrder = C2.GroupChannelOrder
|
||||
)
|
||||
END
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
CREATE FUNCTION [dbo].[foo_GetIdenticalGroupChannelSettingsCount]
|
||||
(
|
||||
@ChannelId1 BIGINT,
|
||||
@ChannelId2 BIGINT
|
||||
)
|
||||
RETURNS int
|
||||
AS
|
||||
BEGIN
|
||||
return (
|
||||
SELECT COUNT(*)
|
||||
FROM [DataPro].[dbo].[GroupChannelSettings] G1,
|
||||
[DataPro].[dbo].[GroupChannelSettings] G2
|
||||
WHERE G1.ChannelId = @ChannelId1
|
||||
AND G2.ChannelId = @ChannelId2
|
||||
AND G1.SettingId = G2.SettingId
|
||||
AND G1.SettingValue = G2.SettingValue
|
||||
)
|
||||
END
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
CREATE FUNCTION [dbo].[foo_GetTotalChannelCount]
|
||||
(
|
||||
@GroupId int
|
||||
)
|
||||
RETURNS int
|
||||
AS
|
||||
BEGIN
|
||||
return (SELECT COUNT(*) FROM [DataPro].[dbo].[Channels] WHERE GroupId = @GroupId)
|
||||
END
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
CREATE FUNCTION [dbo].[foo_GetTotalGroupChannelSettingsCount]
|
||||
(
|
||||
@ChannelId BIGINT
|
||||
)
|
||||
RETURNS INT
|
||||
AS
|
||||
BEGIN
|
||||
RETURN (SELECT COUNT(*) FROM [DataPro].[dbo].[GroupChannelSettings] WHERE ChannelId = @ChannelId)
|
||||
END
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
|
||||
CREATE PROCEDURE [dbo].[sp_CompareGroupChannelSettings]
|
||||
|
||||
@GroupId1 INT,
|
||||
@GroupId2 INT,
|
||||
@Result BIT OUTPUT
|
||||
|
||||
AS
|
||||
BEGIN
|
||||
BEGIN TRY
|
||||
DECLARE @tChannels1 table (
|
||||
ChannelId BIGINT
|
||||
,SensorId INT
|
||||
,Processed BIT)
|
||||
|
||||
DECLARE @tChannels2 table (
|
||||
ChannelId BIGINT
|
||||
,SensorId INT
|
||||
,Processed BIT)
|
||||
|
||||
INSERT INTO @tChannels1
|
||||
SELECT Id
|
||||
,SensorId
|
||||
,0
|
||||
FROM [dbo].[Channels] WHERE GroupId = @GroupId1 ORDER BY SensorId
|
||||
|
||||
INSERT INTO @tChannels2
|
||||
SELECT Id
|
||||
,SensorId
|
||||
,0
|
||||
FROM [dbo].[Channels] WHERE GroupId = @GroupId2 ORDER BY SensorId
|
||||
|
||||
IF ((SELECT COUNT(*) FROM @tChannels1) <> (SELECT COUNT(*) FROM @tChannels2))
|
||||
BEGIN
|
||||
SET @Result = 0
|
||||
RETURN;
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
IF ((SELECT COUNT(*) FROM @tChannels1) > 0) -- Both counts should be the same
|
||||
BEGIN
|
||||
WHILE ((SELECT COUNT(*) From @tChannels1 Where Processed = 0) > 0)
|
||||
BEGIN
|
||||
DECLARE @ChannelId1 BIGINT
|
||||
DECLARE @ChannelId2 BIGINT
|
||||
DECLARE @TotalCountChannel1 INT
|
||||
DECLARE @TotalCountChannel2 INT
|
||||
DECLARE @IdenticalCount INT
|
||||
|
||||
SELECT TOP 1
|
||||
@ChannelId1 = ChannelId
|
||||
FROM @tChannels1 WHERE Processed = 0
|
||||
|
||||
SELECT TOP 1
|
||||
@ChannelId2 = ChannelId
|
||||
FROM @tChannels2 WHERE Processed = 0
|
||||
|
||||
SET @TotalCountChannel1 = dbo.foo_GetTotalGroupChannelSettingsCount(@ChannelId1)
|
||||
SET @TotalCountChannel2 = dbo.foo_GetTotalGroupChannelSettingsCount(@ChannelId2)
|
||||
IF (@TotalCountChannel1 <> @TotalCountChannel2)
|
||||
BEGIN
|
||||
SET @Result = 0
|
||||
RETURN
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
IF (@TotalCountChannel1 > 0) -- Both total counts are the same
|
||||
BEGIN
|
||||
SET @IdenticalCount = [dbo].[foo_GetIdenticalGroupChannelSettingsCount](@ChannelId1, @ChannelId2)
|
||||
IF (@IdenticalCount <> @TotalCountChannel1) -- Both total counts are the same
|
||||
BEGIN
|
||||
SET @Result = 0
|
||||
RETURN
|
||||
END
|
||||
END
|
||||
|
||||
UPDATE @tChannels1 set [Processed] = 1 where ChannelId = @ChannelId1
|
||||
UPDATE @tChannels2 set [Processed] = 1 where ChannelId = @ChannelId2
|
||||
END
|
||||
END
|
||||
END
|
||||
SET @Result = 1
|
||||
END
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SET @Result = 0
|
||||
END CATCH
|
||||
END
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
|
||||
CREATE PROCEDURE [dbo].[sp_CompareGroupHardware]
|
||||
|
||||
@StaticGroupId INT,
|
||||
@EmbeddedGroupId INT,
|
||||
@Result BIT OUTPUT
|
||||
|
||||
AS
|
||||
BEGIN
|
||||
BEGIN TRY
|
||||
DECLARE @tStaticHardware table (
|
||||
DASId INT
|
||||
,Processed BIT)
|
||||
|
||||
DECLARE @tEmbeddedHardware table (
|
||||
DASId INT)
|
||||
|
||||
INSERT INTO @tStaticHardware
|
||||
SELECT DASId
|
||||
,0
|
||||
FROM [dbo].[GroupHardware] WHERE GroupId = @StaticGroupId ORDER BY DASId
|
||||
|
||||
INSERT INTO @tEmbeddedHardware
|
||||
SELECT DASId
|
||||
FROM [dbo].[GroupHardware] WHERE GroupId = @EmbeddedGroupId ORDER BY DASId
|
||||
|
||||
WHILE ((SELECT COUNT(*) From @tStaticHardware Where Processed = 0) > 0)
|
||||
BEGIN
|
||||
DECLARE @StaticDASId INT
|
||||
DECLARE @EmbeddedDASId INT
|
||||
|
||||
SELECT TOP 1
|
||||
@StaticDASId = DASId
|
||||
FROM @tStaticHardware WHERE Processed = 0
|
||||
|
||||
IF ((SELECT COUNT(*) FROM @tEmbeddedHardware WHERE DASId = @StaticDASId) = 0)
|
||||
BEGIN
|
||||
SET @Result = 0
|
||||
RETURN;
|
||||
END
|
||||
|
||||
UPDATE @tStaticHardware set [Processed] = 1 where DASId = @StaticDASId
|
||||
END
|
||||
SET @Result = 1
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SET @Result = 0
|
||||
END CATCH
|
||||
END
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
|
||||
CREATE PROCEDURE [dbo].[sp_CompareGroups]
|
||||
|
||||
@StaticDescription NVARCHAR(255),
|
||||
@StaticGroupId INT,
|
||||
@EmbeddedGroupId INT,
|
||||
@Result BIT output
|
||||
|
||||
AS
|
||||
BEGIN
|
||||
IF ((SELECT COUNT(*) FROM [dbo].[Groups] WHERE Id = @EmbeddedGroupId AND Description = @StaticDescription) = 0)
|
||||
BEGIN
|
||||
SET @Result = 0
|
||||
RETURN;
|
||||
END
|
||||
|
||||
SET NOCOUNT ON;
|
||||
DECLARE @TotalCountStaticGroup INT
|
||||
DECLARE @TotalCountEmbeddedGroup INT
|
||||
DECLARE @IdenticalCount INT
|
||||
|
||||
SET @TotalCountStaticGroup = [dbo].[foo_GetTotalChannelCount](@StaticGroupId)
|
||||
SET @TotalCountEmbeddedGroup = [dbo].[foo_GetTotalChannelCount](@EmbeddedGroupId)
|
||||
IF (@TotalCountStaticGroup <> @TotalCountEmbeddedGroup)
|
||||
BEGIN
|
||||
SET @Result = 0
|
||||
RETURN;
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
IF (@TotalCountStaticGroup > 0) -- Both TotalCounts are the same
|
||||
BEGIN
|
||||
SET @IdenticalCount = [dbo].[foo_GetIdenticalChannelCount](@StaticGroupId, @EmbeddedGroupId)
|
||||
IF (@IdenticalCount <> @TotalCountStaticGroup) -- Both TotalCounts are the same
|
||||
BEGIN
|
||||
SET @Result = 0
|
||||
RETURN;
|
||||
END
|
||||
END
|
||||
END
|
||||
|
||||
BEGIN TRY
|
||||
EXEC [dbo].[sp_CompareGroupHardware] @StaticGroupId, @EmbeddedGroupId, @Result OUTPUT
|
||||
IF (@Result = 0)
|
||||
BEGIN
|
||||
RETURN
|
||||
END
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SET @Result = 0
|
||||
END CATCH
|
||||
|
||||
BEGIN TRY
|
||||
EXEC [dbo].[sp_CompareGroupChannelSettings] @StaticGroupId, @EmbeddedGroupId, @Result OUTPUT
|
||||
IF (@Result = 0)
|
||||
BEGIN
|
||||
RETURN
|
||||
END
|
||||
END TRY
|
||||
BEGIN CATCH
|
||||
SET @Result = 0
|
||||
END CATCH
|
||||
|
||||
SET @Result = 1
|
||||
END
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,20 @@
|
||||
CREATE PROCEDURE [dbo].[sp_ChannelSettingsUpdate]
|
||||
@Id int,
|
||||
@DefaultValue NVARCHAR(255),
|
||||
@errorNumber int OUTPUT,
|
||||
@errorMessage NVARCHAR (255) OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET @errorMessage = ''
|
||||
SET @errorNumber = 0
|
||||
|
||||
UPDATE [dbo].[ChannelSettings] SET [DefaultValue]=@DefaultValue WHERE [Id]=@Id
|
||||
|
||||
IF(@@error != 0)
|
||||
BEGIN
|
||||
SET @errorNumber = error_number()
|
||||
SET @errorMessage = error_message()
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
CREATE PROCEDURE [dbo].[sp_LockFree]
|
||||
@UserId INT = NULL
|
||||
,@UserName NVARCHAR(50) = NULL
|
||||
,@ItemId BIGINT = NULL
|
||||
,@CategoryId INT
|
||||
,@errorNumber INT OUTPUT
|
||||
,@errorMessage NVARCHAR(250) OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET @errorNumber = 0
|
||||
SET @errorMessage = space(0)
|
||||
|
||||
IF(@UserId) IS NULL
|
||||
BEGIN
|
||||
IF NOT EXISTS( SELECT ID FROM Users WHERE UserName=@UserName)
|
||||
BEGIN
|
||||
SET @errorNumber = 2
|
||||
SET @errorMessage = 'User not found'
|
||||
return -1
|
||||
END
|
||||
END
|
||||
|
||||
IF NOT EXISTS( SELECT LockId FROM LockedItems WHERE CategoryId=@CategoryId AND ItemId=@ItemId)
|
||||
BEGIN
|
||||
SET @errorNumber = 3
|
||||
SET @errorMessage = 'No lock to free'
|
||||
return -1
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
DECLARE @UpdateTime DateTime
|
||||
DELETE from LockedItems WHERE CategoryId=@CategoryId AND ItemId=@ItemId
|
||||
END
|
||||
END
|
||||
@@ -0,0 +1,121 @@
|
||||
CREATE PROCEDURE [dbo].[sp_LockGet]
|
||||
@UserId INT = NULL
|
||||
,@UserName NVARCHAR(50) = NULL
|
||||
,@ItemId INT = NULL
|
||||
,@ItemKey NVARCHAR(50) = NULL
|
||||
,@ItemCategory NVARCHAR(50)
|
||||
,@MachineName NVARCHAR(50)
|
||||
,@errorNumber INT OUTPUT
|
||||
,@errorMessage NVARCHAR(250) OUTPUT
|
||||
,@LockingUser NVARCHAR(50) OUTPUT
|
||||
,@LockingMachineName NVARCHAR(50) OUTPUT
|
||||
,@LastUsedTime DATETIME OUTPUT
|
||||
,@LockCreateTime DATETIME OUTPUT
|
||||
,@LockedItemCategory INT OUTPUT
|
||||
,@LockedItemId INT OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET @errorNumber = 0
|
||||
SET @errorMessage = SPACE(0)
|
||||
SET @LockingUser = SPACE(0)
|
||||
SET @LockingMachineName = SPACE(0)
|
||||
SET @LastUsedTime = NULL
|
||||
SET @LockCreateTime = NULL
|
||||
DECLARE @CategoryId INT
|
||||
|
||||
IF NOT EXISTS( SELECT CategoryId FROM LockedItemCategories WHERE CategoryText=@ItemCategory)
|
||||
BEGIN
|
||||
INSERT INTO LockedItemCategories (CategoryText) VALUES (@ItemCategory)
|
||||
SET @CategoryId = SCOPE_IDENTITY()
|
||||
SET @LockedItemCategory = @CategoryId
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
SELECT @CategoryId = CategoryId from LockedItemCategories WHERE CategoryText=@ItemCategory
|
||||
SET @LockedItemCategory = @CategoryId
|
||||
END
|
||||
|
||||
IF @ItemId IS NULL
|
||||
BEGIN
|
||||
IF @ItemCategory = 'TestSetup'
|
||||
BEGIN
|
||||
IF NOT EXISTS( SELECT TestSetupId from TestSetups WHERE TestSetupName=@ItemKey)
|
||||
BEGIN
|
||||
SET @errorNumber = 1
|
||||
SET @errorMessage = 'TestSetup not found'
|
||||
SET @LockedItemId = -1
|
||||
return -1
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
SELECT @ItemId = TestSetupId from TestSetups where TestSetupName=@ItemKey
|
||||
SET @LockedItemId = @ItemId
|
||||
END
|
||||
END
|
||||
ELSE IF @ItemCategory = 'Group'
|
||||
BEGIN
|
||||
IF NOT EXISTS( SELECT Id from Groups WHERE SerialNumber=@ItemKey)
|
||||
BEGIN
|
||||
SET @errorNumber = 1
|
||||
SET @errorMessage = 'Group not found'
|
||||
SET @LockedItemId = -1
|
||||
return -1
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
SELECT @ItemId = Id from Groups where SerialNumber=@ItemKey
|
||||
SET @LockedItemId = @ItemId
|
||||
END
|
||||
END
|
||||
ELSE IF @ItemCategory = 'Sensor'
|
||||
BEGIN
|
||||
IF NOT EXISTS( SELECT Id from Sensors WHERE SerialNumber=@ItemKey)
|
||||
BEGIN
|
||||
SET @errorNumber = 1
|
||||
SET @errorMessage = 'Sensor not found'
|
||||
SET @LockedItemId = -1
|
||||
return -1
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
SELECT @ItemId = Id from Sensors where SerialNumber=@ItemKey
|
||||
SET @LockedItemId = @ItemId
|
||||
END
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
SET @errorNumber = 4
|
||||
SET @errorMessage = 'Unknown category'
|
||||
SET @LockedItemId = -1
|
||||
return -1
|
||||
END
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
SET @LockedItemId=@ItemId
|
||||
END
|
||||
|
||||
IF(@UserId) IS NULL
|
||||
BEGIN
|
||||
IF NOT EXISTS( SELECT ID FROM Users WHERE UserName=@UserName)
|
||||
BEGIN
|
||||
SET @errorNumber = 2
|
||||
SET @errorMessage = 'User not found'
|
||||
return -1
|
||||
END
|
||||
END
|
||||
|
||||
IF NOT EXISTS( SELECT LockId FROM LockedItems WHERE CategoryId=@CategoryId AND ItemId=@ItemId)
|
||||
BEGIN
|
||||
DECLARE @InsertTime DateTime
|
||||
SET @InsertTime = GETDATE()
|
||||
INSERT INTO LockedItems (CategoryId, ItemId, MachineName, DataPROUserID, StartTime, LastTouch) VALUES (@CategoryId, @ItemId, @MachineName, @UserId, @InsertTime, @InsertTime)
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
SELECT @LockingUser = B.UserName, @LockingMachineName=A.MachineName, @LastUsedTime=A.LastTouch, @LockCreateTime=A.StartTime FROM LockedItems as A INNER JOIN Users as B on A.DataPROUserID=B.ID WHERE A.CategoryId=@CategoryId AND A.ItemId=@ItemId
|
||||
SET @errorNumber = 3
|
||||
SET @errorMessage = 'Already locked'
|
||||
return -1
|
||||
END
|
||||
END
|
||||
@@ -0,0 +1,53 @@
|
||||
CREATE PROCEDURE [dbo].[sp_LockUpdate]
|
||||
@UserId INT = NULL
|
||||
,@UserName NVARCHAR(50) = NULL
|
||||
,@ItemId INT = NULL
|
||||
,@CategoryId INT
|
||||
,@MachineName NVARCHAR(50)
|
||||
,@errorNumber INT OUTPUT
|
||||
,@errorMessage NVARCHAR(250) OUTPUT
|
||||
,@LockingUser NVARCHAR(50) OUTPUT
|
||||
,@LockingMachine NVARCHAR(50) OUTPUT
|
||||
,@LastUsedTime DATETIME OUTPUT
|
||||
,@LockCreateTime DATETIME OUTPUT
|
||||
AS
|
||||
BEGIN
|
||||
SET @errorNumber = 0
|
||||
SET @errorMessage = space(0)
|
||||
SET @LockingUser = space(0)
|
||||
SET @LockingMachine = space(0)
|
||||
SET @LastUsedTime = null
|
||||
SET @LockCreateTime = null
|
||||
|
||||
IF(@UserId) IS NULL
|
||||
BEGIN
|
||||
IF NOT EXISTS( SELECT ID FROM Users WHERE UserName=@UserName)
|
||||
BEGIN
|
||||
SET @errorNumber = 2
|
||||
SET @errorMessage = 'User not found'
|
||||
return -1
|
||||
END
|
||||
END
|
||||
|
||||
IF NOT EXISTS( SELECT LockId FROM LockedItems WHERE CategoryId=@CategoryId AND ItemId=@ItemId AND DataPROUserID=@UserId AND MachineName=@MachineName)
|
||||
BEGIN
|
||||
IF EXISTS( SELECT LockId FROM LockedItems WHERE CategoryId=@CategoryId AND ItemId=@ItemId)
|
||||
BEGIN
|
||||
SET @errorNumber = 4
|
||||
SET @errorMessage = 'Locked by another user'
|
||||
SELECT @LockingUser = B.UserName, @LockingMachine=A.MachineName, @LastUsedTime=A.LastTouch, @LockCreateTime=A.StartTime FROM LockedItems as A INNER JOIN Users as B on A.DataPROUserID=B.ID WHERE A.CategoryId=@CategoryId AND A.ItemId=@ItemId
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
SET @errorNumber = 3
|
||||
SET @errorMessage = 'No lock to update'
|
||||
return -1
|
||||
END
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
DECLARE @UpdateTime DateTime
|
||||
SET @UpdateTime = GetDate()
|
||||
UPDATE LockedItems Set LastTouch=@UpdateTime WHERE CategoryId=@CategoryId AND ItemId=@ItemId AND DataPROUserID=@UserId
|
||||
END
|
||||
END
|
||||
Binary file not shown.
Reference in New Issue
Block a user