webservice stichproben

This commit is contained in:
Stoyan Zlatev
2025-02-05 11:02:36 +01:00
parent 9e2f9b18bd
commit 09a3b252f8
5 changed files with 44 additions and 46 deletions
@@ -308,10 +308,12 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
sb.AppendLine($" where CordonelPressureTest_PcbId = @PcbId and CordonelPressureTest_FertigungsAuftragsNr = @PcbIsPartOfOrder ");
sb.AppendLine($" and CordonelPressureTest_Valid = 1 and CordonelPressureTest_IsDeleted = 0 ");
sb.AppendLine($" ");
sb.AppendLine($" select top 1 @LastPressureTest = [Pruefgang] from [Druckpruefung] ");
sb.AppendLine($" where [FabNr] = @PcbId and [FertigungsauftragNr] = @PcbIsPartOfOrder ");
sb.AppendLine($" and [Dicht] = 1 ");
sb.AppendLine($" order by [Pruefgang] desc ");
sb.AppendLine($" select top 1 @LastPressureTest = case when(IstStichprobe = 0 or(IstStichprobe = 1 and IstDicht = 1)) then 1 else null end ");
sb.AppendLine($" from Stichproben left outer join [Druckpruefung] on[FabNr] = PcbId ");
sb.AppendLine($" where[FabNr] = @PcbId and [FertigungsauftragNr] = @PcbIsPartOfOrder ");
sb.AppendLine($" order by [id] desc ");
@@ -55,32 +55,18 @@ namespace Service.MeterProcessState.Controllers
query.AppendLine(" declare @Valid bit");
query.AppendLine(" declare @Text nvarchar(250)");
query.AppendLine(" declare @StationId int");
query.AppendLine(" declare @LeakRate nvarchar(50)");
query.AppendLine(" declare @TestPressure nvarchar(50)");
query.AppendLine(" declare @TesterName nvarchar(50)");
query.AppendLine(" declare @TestId int");
query.AppendLine(" declare @Ordernr int");
query.AppendLine($" set @pcbID = {testResult.PcbId}");
query.AppendLine($" set @Valid = {(testResult.Passed.Value ? "1" : "0")}");
query.AppendLine($" set @Text = '{testResult.Remark}'");
query.AppendLine($" set @LeakRate = '{testResult.LeakRate}'");
query.AppendLine($" set @TestPressure = '{testResult.TestPressure}'");
query.AppendLine($" set @TesterName = '{testResult.TesterName}'");
query.AppendLine($" set @StationId = 2");
query.AppendLine(" SELECT TOP (1)");
query.AppendLine(" @Ordernr = [CordonelAssignedPicking_FertigungsAuftragsNr]");
query.AppendLine(" FROM [Auftrag].[dbo].[Cordonel_AssignedPicking]");
@@ -103,11 +89,7 @@ namespace Service.MeterProcessState.Controllers
query.AppendLine(" ,0");
query.AppendLine(" ,@Text");
query.AppendLine(" ,@StationId)");
query.AppendLine(" set @TestId = @@IDENTITY");
query.AppendLine(" INSERT INTO [dbo].[Cordonel_PressureTest_He]");
query.AppendLine(" ([CordonelPressureTestHe_TestID]");
query.AppendLine(" ,[CordonelPressureTestHe_LeakRate]");
@@ -132,26 +114,23 @@ namespace Service.MeterProcessState.Controllers
}
query.AppendLine($" declare @TestIdStr nvarchar(250) ");
query.AppendLine($" set @TestIdStr = cast(@TestId as nvarchar(250)) ");
query.AppendLine($" if (substring(@TestIdStr, LEN(@TestIdStr) , 1 ) = '0' ) ");
query.AppendLine($" BEGIN ");
query.AppendLine($" Select 1 as PressuretestNeeded ");
query.AppendLine($" end ");
query.AppendLine($" else ");
query.AppendLine($" begin ");
query.AppendLine($" INSERT INTO [dbo].[Druckpruefung] select 0,'Übersprungen wegen Stichprobe', current_timestamp ,0,0,0,0,@pcbID, null,null,null,null,'WZ',NULL,NULL,NULL, @Ordernr, 1 ,null,null,1 ");
query.AppendLine($" Select 0 as PressuretestNeeded ");
query.AppendLine($" end ");
//query.AppendLine($" declare @TestIdStr nvarchar(250) ");
//query.AppendLine($" set @TestIdStr = cast(@TestId as nvarchar(250)) ");
//query.AppendLine($" if (substring(@TestIdStr, LEN(@TestIdStr) , 1 ) = '0' ) ");
//query.AppendLine($" BEGIN ");
//query.AppendLine($" Select 1 as PressuretestNeeded ");
//query.AppendLine($" end ");
//query.AppendLine($" else ");
//query.AppendLine($" begin ");
//query.AppendLine($" INSERT INTO [dbo].[Druckpruefung] select 0,'Übersprungen wegen Stichprobe', current_timestamp ,0,0,0,0,@pcbID, null,null,null,null,'WZ',NULL,NULL,NULL, @Ordernr, 1 ,null,null,1 ");
//query.AppendLine($" Select 0 as PressuretestNeeded ");
//query.AppendLine($" end ");
var dt = dataacces.ExecuteQuery(query.ToString());
return ((int)dt.Rows[0]["PressuretestNeeded"]).ToString();
return true;
// return ((int)dt.Rows[0]["PressuretestNeeded"]).ToString();
}