From 594e64b01ff02f3681b954bdc33dab3d4b4ab553 Mon Sep 17 00:00:00 2001 From: Roland Drabesch Date: Tue, 6 Aug 2024 15:45:06 +0200 Subject: [PATCH] merge --- Common/.vs/config/applicationhost.config | 2 +- .../CordonelPreadjustmentUi.csproj | 5 ++-- .../OrderData/OrderProgrammingParameters.cs | 6 +++-- Common/ProductionUiCordonel/FinalTest.xaml | 2 +- .../Actions/ProductionCheckShippingState.cs | 23 ++++------------ .../Controllers/PasswordController.cs | 23 +++++++++++++--- .../Controllers/TestBenchController.cs | 4 +-- Common/Ui/GenesisToolBox/FrmQsTool.cs | 26 +++++++++++++++++++ 8 files changed, 60 insertions(+), 31 deletions(-) diff --git a/Common/.vs/config/applicationhost.config b/Common/.vs/config/applicationhost.config index a894c3cf..de10b180 100644 --- a/Common/.vs/config/applicationhost.config +++ b/Common/.vs/config/applicationhost.config @@ -155,7 +155,7 @@ - + diff --git a/Common/CordonelPreadjustmentUi/CordonelPreadjustmentUi.csproj b/Common/CordonelPreadjustmentUi/CordonelPreadjustmentUi.csproj index c9ab64d1..c616b2a4 100644 --- a/Common/CordonelPreadjustmentUi/CordonelPreadjustmentUi.csproj +++ b/Common/CordonelPreadjustmentUi/CordonelPreadjustmentUi.csproj @@ -116,9 +116,8 @@ - - true - + + ..\packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll diff --git a/Common/Logic/ProductionOrderCore/OrderData/OrderProgrammingParameters.cs b/Common/Logic/ProductionOrderCore/OrderData/OrderProgrammingParameters.cs index ab3faa6d..ac93a0ef 100644 --- a/Common/Logic/ProductionOrderCore/OrderData/OrderProgrammingParameters.cs +++ b/Common/Logic/ProductionOrderCore/OrderData/OrderProgrammingParameters.cs @@ -75,6 +75,10 @@ namespace Xylem.Common.Logic.ProductionOrderCore.OrderData var csdIdent = vakoData.KeyValues.FirstOrDefault(a => a.Name == "C_GEN_CSD")?.Value; + if (String.IsNullOrEmpty(csdIdent)) + { + throw new ApplicationException("CSD Could not befound"); + } if (orderNr == 3204790) { csdIdent = "773328"; @@ -141,8 +145,6 @@ namespace Xylem.Common.Logic.ProductionOrderCore.OrderData ident += vakoData.KeyValues.First(k => k.Key == "Nennweite").Charcode; } - - var retStr = LocalWebRequest.GetRequest($"http://sla12iis01/csdcore/csdservice/getstampings?CsdIdent={csdIdent}&GroupId=1&ProductIdent={ident}&ProductDn={rawVako.Dn}&ShowOnlyValidStampings=0", 8000); var retListRealCsd = JsonConvert.DeserializeObject>(retStr); if (retListRealCsd != null && retListRealCsd.Any()) diff --git a/Common/ProductionUiCordonel/FinalTest.xaml b/Common/ProductionUiCordonel/FinalTest.xaml index 69847d9c..0306640a 100644 --- a/Common/ProductionUiCordonel/FinalTest.xaml +++ b/Common/ProductionUiCordonel/FinalTest.xaml @@ -8,7 +8,7 @@ mc:Ignorable="d" Title="FinalTest" MinHeight="500" MinWidth="600" Height="638" Width="800" Initialized="Window_Initialized" Closing="Window_Closing" PreviewKeyDown="Window_PreviewKeyDown"> - + diff --git a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionCheckShippingState.cs b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionCheckShippingState.cs index 6b32d3ba..cccd7fd8 100644 --- a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionCheckShippingState.cs +++ b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionCheckShippingState.cs @@ -75,6 +75,9 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions var res = JsonConvert.DeserializeObject(csdRet); + + + var CalibrationRun = res[4]; var LastTestBechState = 0; Boolean? HyState; @@ -122,7 +125,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions var genesisStatus = new GenesisStatus(); // this calculates all life time values - if (!GenesisStatusHandler.BuildLifeTimeInformation(Meter, genesisStatus)) + if (!GenesisStatusHandler.BuildLifeTimeInformation(Meter, genesisStatus)) { setTxt("Batterie nicht lesbar", true, true); @@ -145,23 +148,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions { - if ( - Meter.PcbId == "235130036" || - Meter.PcbId == "235130211" || - Meter.PcbId == "235130121" || - Meter.PcbId == "235130122" || - Meter.PcbId == "235130353" || - Meter.PcbId == "235130447" || - Meter.PcbId == "235130112" || - Meter.PcbId == "235130582" || - Meter.PcbId == "235130237") - { - //currentProcessState = ProductionProcessState.Error; - } - else - { - //currentProcessState = ProductionProcessState.Error; - } + currentProcessState = ProductionProcessState.Error; } // diff --git a/Common/Service/MeterProcessState/Controllers/PasswordController.cs b/Common/Service/MeterProcessState/Controllers/PasswordController.cs index ffbce012..ab2b4c11 100644 --- a/Common/Service/MeterProcessState/Controllers/PasswordController.cs +++ b/Common/Service/MeterProcessState/Controllers/PasswordController.cs @@ -523,7 +523,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers var sbQuery = new StringBuilder(); - sbQuery.AppendLine($" SELECT "); + sbQuery.AppendLine($" SELECT distinct "); sbQuery.AppendLine($" [Seriennummer] "); sbQuery.AppendLine($" ,mps.MapPcbIdToSerialNumber_PcbId "); sbQuery.AppendLine($" ,[Adresse] "); @@ -536,6 +536,8 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers sbQuery.AppendLine($" ,passwordtbl.Password "); sbQuery.AppendLine($" ,passwordtbl.KitronSkeletonKey as Skeleton "); sbQuery.AppendLine($" ,passwordtbl.ProcessorID as ProcessorUid "); + sbQuery.AppendLine($" ,passwordtbl.radioAdress "); + sbQuery.AppendLine($" FROM [Auftrag].[dbo].[Genesis_Meter] meter "); sbQuery.AppendLine($" inner join MapPcbIdToSerialNumber mps" + $" on mps.MapPcbIdToSerialNumber_SerialNumber = meter.Seriennummer and mps.MapPcbIdToSerialNumber_Deleted = 0 "); @@ -556,13 +558,26 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers using (var dataAccess = new SqlDataAccess(GlobalConfig.connectionString.Value)) { var dt = dataAccess.ExecuteQuery(sbQuery.ToString()); + if (dt.Rows.Count != 1) + { + return Request.CreateResponse(HttpStatusCode.InternalServerError, new PcbIdNotException("Pcb not unique, mapping problem", new Guid("160B4C44-6EF7-41DC-A48D-4B4105B4779B"))); + } foreach (var item in dt.Select()) { result.OrderNumber = (Int32)item["FertigungsauftragNr"]; result.RadioAddress = (Int64)item["Adresse"]; result.Skeleton = (String)item["Skeleton"]; result.Password = (String)item["Password"]; - result.PasswordFileIdent = (result.RadioAddress.HasValue && result.RadioAddress.Value != 0) ? result.RadioAddress.Value.ToString() : PcbId; + if (item["radioAdress"].GetType() != typeof(System.DBNull)) + { + result.PasswordFileIdent = (String)item["radioAdress"].ToString(); + } + else + { + result.PasswordFileIdent = (result.RadioAddress.HasValue && result.RadioAddress.Value != 0) ? result.RadioAddress.Value.ToString() : PcbId; + } + + if (item["KeySetId"].GetType() != typeof(System.DBNull)) { result.KeySetId = (String)item["KeySetId"]; @@ -864,10 +879,10 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers return LocalWebRequest.PostRequestAsyncAndGetContent(url: Url, header: header, json: helpArray.ToArray(), timeoutMs: 20000); } - catch (Exception) + catch (Exception ex) { - throw; + return ex.Message; } } diff --git a/Common/Service/MeterProcessState/Controllers/TestBenchController.cs b/Common/Service/MeterProcessState/Controllers/TestBenchController.cs index 492d322e..76cb8147 100644 --- a/Common/Service/MeterProcessState/Controllers/TestBenchController.cs +++ b/Common/Service/MeterProcessState/Controllers/TestBenchController.cs @@ -133,8 +133,8 @@ $"{x.GetValue(0)}", // SerialNr, $"{x.GetValue(1)}", // FertigungsNr, $"{x.GetValue(2)}", // RadioAddress, - $"{x.GetValue(3)}", // CustomerSerialNr, - $"{x.GetValue(4)}", // CalibrationRunID, + $"{x.GetValue(3)}", // CustomerSerialNr, + $"{x.GetValue(4)}", // CalibrationRunID, $"{x.GetValue(5)}", // LastProcessState, $"{x.GetValue(6)}", // Dn, $"{x.GetValue(7)}", // NewNennweiteID, diff --git a/Common/Ui/GenesisToolBox/FrmQsTool.cs b/Common/Ui/GenesisToolBox/FrmQsTool.cs index 9a03071e..1704d383 100644 --- a/Common/Ui/GenesisToolBox/FrmQsTool.cs +++ b/Common/Ui/GenesisToolBox/FrmQsTool.cs @@ -126,6 +126,32 @@ namespace Xylem.Common.Ui.GenesisToolBox sbMSG.AppendLine(""); sbMSG.AppendLine($"Remaining life time in years {genesisStatus.RemainingLifeTimeYears:F2}"); sbMSG.AppendLine($"Totally drained battery load in % {genesisStatus.DrainedBatteryLoadPercent:F2}"); + sbMSG.AppendLine(""); + if (genesisStatus.UNTStatus) + { + sbMSG.AppendLine($"UNT Limit OK "); + } + else + { + sbMSG.AppendLine($"UNT Limit Failed "); + } + sbMSG.AppendLine($"UNT Limit data Limit {genesisStatus.UNTLimit} Meter has {genesisStatus.DrainedBatteryLoad_uAs}"); + + if (genesisStatus.DrainedBatteryLoad_uAs <= genesisStatus.ExceededLifeTime_s * 77.7) + { + sbMSG.AppendLine($"UNT Limit before testbench OK"); + } + else + { + sbMSG.AppendLine($"UNT Limit before testbench Failed"); + } + sbMSG.AppendLine($"UNT Limit before testbench {genesisStatus.ExceededLifeTime_s * 77.7} Meter has {genesisStatus.DrainedBatteryLoad_uAs}"); + + + + + + //ExceededLifeTime_s * 77.7) MessageBox.Show(sbMSG.ToString(), $"Battery for {_currentGenesis.PcbId} has remaining life " + $"time of {genesisStatus.RemainingLifeTimeYears:F2} years");