init
This commit is contained in:
@@ -0,0 +1,263 @@
|
||||
--Insert
|
||||
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
|
||||
,@DoStreaming bit
|
||||
,@ClockSyncProfileMaster nvarchar(50)
|
||||
,@ClockSyncProfileSlave nvarchar(50)
|
||||
,@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]
|
||||
,[DoStreaming]
|
||||
,[ClockSyncProfileMaster]
|
||||
,[ClockSyncProfileSlave]
|
||||
,[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
|
||||
,@DoStreaming
|
||||
,@ClockSyncProfileMaster
|
||||
,@ClockSyncProfileSlave
|
||||
,@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,86 @@
|
||||
ALTER PROCEDURE [dbo].[sp_DASUpdate]
|
||||
@DASId int = 0
|
||||
,@SerialNumber nvarchar(50) = null
|
||||
,@Type int
|
||||
,@MaxModules int
|
||||
,@MaxMemory bigint
|
||||
,@MaxSampleRate decimal(18,0)
|
||||
,@MinSampleRate decimal(18,0)
|
||||
,@FirmwareVersion nvarchar(50)
|
||||
,@CalDate datetime
|
||||
,@ProtocolVersion int
|
||||
,@LastModified datetime
|
||||
,@LastModifiedBy nvarchar(50)
|
||||
,@Version int
|
||||
,@LocalOnly bit
|
||||
,@LastUsed datetime
|
||||
,@LastUsedBy nvarchar(50)
|
||||
,@Connection nvarchar(50)
|
||||
,@Channels int
|
||||
,@Position nvarchar(50)
|
||||
,@ChannelTypes nvarchar(255)
|
||||
,@Reprogramable bit
|
||||
,@Reconfigurable bit
|
||||
,@IsModule bit
|
||||
,@PositionOnDistributor smallint
|
||||
,@PositionOnChain smallint
|
||||
,@Port smallint
|
||||
,@ParentDAS nvarchar(50)
|
||||
,@FirstUseDate datetime null
|
||||
,@TestId int null
|
||||
,@GroupId int null
|
||||
,@StandIn bit null
|
||||
,@new_id int output
|
||||
,@errorNumber int output
|
||||
,@errorMessage nvarchar(250) output
|
||||
AS
|
||||
BEGIN
|
||||
set @errorNumber = 0
|
||||
set @errorMessage = space(0)
|
||||
|
||||
SET NOCOUNT ON;
|
||||
if(@SerialNumber is null)
|
||||
begin
|
||||
set @errorNumber = 15600
|
||||
set @errorMessage = 'An invalid parameter or option was specified for procedure'
|
||||
end
|
||||
else
|
||||
begin
|
||||
if(@DASId = 0)
|
||||
begin
|
||||
set @DASId = dbo.foo_IdGetDAS(@SerialNumber)
|
||||
end
|
||||
SET @new_id = @DASId
|
||||
UPDATE [dbo].[DAS]
|
||||
SET [Type] = @Type
|
||||
,[MaxModules] = @MaxModules
|
||||
,[MaxMemory] = @MaxMemory
|
||||
,[MaxSampleRate] = @MaxSampleRate
|
||||
,[MinSampleRate] = @MinSampleRate
|
||||
,[FirmwareVersion] = @FirmwareVersion
|
||||
,[CalDate] = @CalDate
|
||||
,[ProtocolVersion] = @ProtocolVersion
|
||||
,[LastModified] = @LastModified
|
||||
,[LastModifiedBy] = @LastModifiedBy
|
||||
,[Version] = @Version
|
||||
,[LocalOnly] = @LocalOnly
|
||||
,[LastUsed] = @LastUsed
|
||||
,[LastUsedBy] = @LastUsedBy
|
||||
,[Connection] = @Connection
|
||||
,[Channels] = @Channels
|
||||
,[Position] = @Position
|
||||
,[ChannelTypes] = @ChannelTypes
|
||||
,[Reprogramable] = @Reprogramable
|
||||
,[Reconfigurable] = @Reconfigurable
|
||||
,[IsModule] = @IsModule
|
||||
,[PositionOnDistributor]= @PositionOnDistributor
|
||||
,[PositionOnChain] = @PositionOnChain
|
||||
,[Port] = @Port
|
||||
,[ParentDAS] = @ParentDAS
|
||||
,[FirstUseDate] = @FirstUseDate
|
||||
,[TestId] = @TestId
|
||||
,[GroupId] = @GroupId
|
||||
,[StandIn] = @StandIn
|
||||
WHERE [DASId] = @DASId
|
||||
end
|
||||
END
|
||||
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
CREATE TYPE [dbo].[IDList] AS TABLE(
|
||||
[ID] [int] NULL
|
||||
);
|
||||
@@ -0,0 +1,22 @@
|
||||
ALTER PROCEDURE [dbo].[sp_ChannelSettingsGet]
|
||||
@Id int = NULL,
|
||||
@SettingName NVARCHAR (255) = NULL
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
IF (@Id IS NOT NULL) OR (@SettingName IS NOT NULL)
|
||||
BEGIN
|
||||
IF (@Id IS NULL)
|
||||
BEGIN
|
||||
SELECT [Id], [DefaultValue] FROM [dbo].[ChannelSettings] where (SettingName = @SettingName) AND (SettingName <> 'ACCouplingEnabled' AND SettingName <>'StreamOutTMATSIntervalMs' AND SettingName <>'BridgeType')
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
SELECT [SettingName] FROM [dbo].[ChannelSettings] where (Id = @Id) AND (SettingName <> 'ACCouplingEnabled' AND SettingName <>'StreamOutTMATSIntervalMs' AND SettingName <>'BridgeType')
|
||||
END
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
SELECT [Id], [SettingName], [DefaultValue] FROM [dbo].[ChannelSettings] WHERE (SettingName <> 'ACCouplingEnabled' AND SettingName <>'StreamOutTMATSIntervalMs' AND SettingName <>'BridgeType')
|
||||
END
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user