This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,190 @@
--Update
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
,@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); 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);
IF @TestEngineerId <= 0
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
,[DoStreaming] = @DoStreaming
,[ClockSyncProfileMaster] = @ClockSyncProfileMaster
,[ClockSyncProfileSlave] = @ClockSyncProfileSlave
,[TestSetup] = @TestSetup
WHERE [TestSetupId] = @TestSetupId
end
end try
begin catch
set @errorMessage = error_message()
set @errorNumber = error_number()
end catch;
END;

View File

@@ -0,0 +1,21 @@
CREATE PROCEDURE [dbo].[sp_DASFirstUseSet]
@DASId int
,@FirstUseDate DateTime null
,@errorNumber int output
,@errorMessage nvarchar(250) output
AS
BEGIN
SET @errorNumber = 0
SET @errorMessage = space(0)
SET NOCOUNT ON;
UPDATE [dbo].[DAS] SET [FirstUseDate]=@FirstUseDate WHERE [DASId]=@DASId;
IF(@@error != 0)
BEGIN
SET @errorNumber = error_number()
SET @errorMessage = error_message()
END
END

View File

@@ -0,0 +1,91 @@
DECLARE @i int
DECLARE @j int
DECLARE @ChannelId int
DECLARE @SensorId int
DECLARE @numChannelRows int
DECLARE @numSensorRows int
DECLARE @ZeroMethod NVARCHAR(255)
DECLARE @ZeroMethodType NVARCHAR(255)
DECLARE @ZeroMethodStart NVARCHAR(255)
DECLARE @ZeroMethodEnd NVARCHAR(255)
DECLARE @delimIndex int
DECLARE @startIndex int
DECLARE @channelidtable TABLE (
idx int Primary Key IDENTITY(1,1)
, ChannelId int
)
CREATE TABLE #channelidtable(
idx int Primary Key IDENTITY(1,1)
, ChannelId int
)
INSERT #channelidtable
SELECT DISTINCT ChannelId FROM GroupChannelSettings WHERE ChannelId IN
(SELECT Id FROM Channels WHERE SensorId IN
(SELECT id FROM Sensors WHERE id in
(SELECT SensorId FROM Channels)
AND SensorType = 0))
SET @i = 1
SET @numChannelRows = (SELECT COUNT(*) FROM @channelidtable)
IF @numChannelRows > 0
WHILE (@i <= (SELECT COUNT(*) FROM @channelidtable))
BEGIN
SET @ChannelId = (SELECT ChannelId FROM @channelidtable WHERE idx = @i)
DECLARE @sensoridtable TABLE (
sensorIdx int Primary Key IDENTITY(1,1)
, sensorId int
)
CREATE TABLE #sensoridtable(
sensorIdx int Primary Key IDENTITY(1,1)
, sensorId int
)
INSERT #sensoridtable
SELECT SensorId FROM Channels WHERE Id = @ChannelId AND SensorId IN
(SELECT id FROM Sensors WHERE SensorType = 0)
SET @j = (SELECT MIN(sensorIdx) FROM #sensoridtable)
SET @numSensorRows = (SELECT COUNT(*) FROM #sensoridtable)
IF @numSensorRows > 0
WHILE (@j <= (SELECT COUNT(*) FROM #sensoridtable))
BEGIN
SET @SensorId = (SELECT SensorId FROM #sensoridtable WHERE sensorIdx = @j)
SET @ZeroMethod = (SELECT ZeroMethod FROM SensorCalibrations WHERE
SensorId = @SensorId AND
ModifyDate = (SELECT MAX (ModifyDate) FROM SensorCalibrations WHERE SensorId = @SensorId))
SET @startIndex = 0
SET @delimIndex = CHARINDEX(',', @ZeroMethod, @startIndex)
SET @ZeroMethodType = SUBSTRING(@ZeroMethod, 0, @delimIndex)
INSERT INTO GroupChannelSettings VALUES (@ChannelId, 20, @ZeroMethodType)
IF @ZeroMethodType = 'AverageOverTime'
BEGIN
SET @startIndex = @delimIndex + 1
SET @delimIndex = CHARINDEX(',', @ZeroMethod, @startIndex)
SET @ZeroMethodStart = SUBSTRING(@ZeroMethod, @startIndex, @delimIndex - @startIndex)
INSERT INTO GroupChannelSettings VALUES (@ChannelId, 21, @ZeroMethodStart)
SET @startIndex = @delimIndex + 1
SET @delimIndex = LEN(@ZeroMethod) + 1
SET @ZeroMethodEnd = SUBSTRING(@ZeroMethod, @startIndex, @delimIndex - @startIndex)
INSERT INTO GroupChannelSettings VALUES (@ChannelId, 22, @ZeroMethodEnd)
END
ELSE
BEGIN
INSERT INTO GroupChannelSettings VALUES (@ChannelId, 21, '-0.05')
INSERT INTO GroupChannelSettings VALUES (@ChannelId, 22, '-0.02')
END
SET @j = @j + 1
END
DROP TABLE #sensoridtable
SET @i = @i + 1
END
DROP TABLE #channelidtable