test container fix

This commit is contained in:
Roland Drabesch
2023-09-19 07:49:58 +02:00
parent df3a7f5449
commit f4a2bee588
10 changed files with 820 additions and 55 deletions
@@ -5,7 +5,7 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D0C8D887-ED52-40AB-A069-90BCE0E801E2}</ProjectGuid>
<OutputType>WinExe</OutputType>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Xylem.Common.Ui.CordonelPreadjustmentUi</RootNamespace>
<AssemblyName>Xylem.Common.Ui.CordonelPreadjustmentUi</AssemblyName>
@@ -105,6 +105,7 @@
<PropertyGroup />
<PropertyGroup />
<PropertyGroup />
<PropertyGroup />
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
@@ -296,21 +296,38 @@ namespace CordonelPreadjustmentUi
private List<Tuple<double, double>> TempFromTofLUT;
internal void StartTempWatch(TempMode tempMode = TempMode.Hand)
{
Meter.WriteLog($"StartTempWatch with {tempMode}");
Meter.logAmpTest = true;
if (tempMode == TempMode.CalcTof)
try
{
TempFromTofLUT = new List<Tuple<double, double>>();
Meter.WriteLog($"StartTempWatch with {tempMode}");
var pcbid = "notFound";
try
Meter.logAmpTest = true;
if (tempMode == TempMode.CalcTof)
{
pcbid = Meter.GetPcbId();
if (string.IsNullOrEmpty(pcbid))
TempFromTofLUT = new List<Tuple<double, double>>();
var pcbid = "notFound";
try
{
pcbid = Meter.GetPcbId();
if (string.IsNullOrEmpty(pcbid))
{
pcbid = Meter.GetPcbId();
if (string.IsNullOrEmpty(pcbid))
{
if (Meter.Slot == 11)
{
pcbid = "193400550";
Meter.WriteLog($"Fake pcbid {pcbid} for 2016 slot 11");
}
else if (Meter.Slot == 12)
{
pcbid = "193400388";
Meter.WriteLog($"Fake pcbid {pcbid} for 2016 slot 12");
}
}
}
if (string.IsNullOrEmpty(pcbid) || pcbid.Length < 5 || pcbid.Length == "1934193400388".Length)
{
if (Meter.Slot == 11)
{
@@ -322,57 +339,48 @@ namespace CordonelPreadjustmentUi
pcbid = "193400388";
Meter.WriteLog($"Fake pcbid {pcbid} for 2016 slot 12");
}
}
}
if (string.IsNullOrEmpty(pcbid) || pcbid.Length < 5)
{
if (Meter.Slot == 11)
var resp = LocalWebRequest.GetRequest($"http://10.49.40.25/MeterProcessState/api/TempFlange/GetLut?PcbId={pcbid}", 50000);
var cordonelTempLut = JsonConvert.DeserializeObject<List<CordonelTempLut>>(resp);
TempFromTofLUT = new List<Tuple<double, double>>();
foreach (var item in cordonelTempLut.OrderBy(a => a.RefTempC))
{
pcbid = "193400550";
Meter.WriteLog($"Fake pcbid {pcbid} for 2016 slot 11");
TempFromTofLUT.Add(new Tuple<double, double>(item.AvgTof, item.RefTempC));
}
else if (Meter.Slot == 12)
var sb = new StringBuilder();
foreach (var t in TempFromTofLUT)
{
pcbid = "193400388";
Meter.WriteLog($"Fake pcbid {pcbid} for 2016 slot 12");
sb.Append("Tof:");
sb.Append(t.Item1);
sb.Append("=Temp:");
sb.Append(t.Item2);
sb.Append(",");
}
Meter.WriteLog($"Load LUT { sb.ToString() } for meter {pcbid}");
}
var resp = LocalWebRequest.GetRequest($"http://10.49.40.25/MeterProcessState/api/TempFlange/GetLut?PcbId={pcbid}", 10000);
var cordonelTempLut = JsonConvert.DeserializeObject<List<CordonelTempLut>>(resp);
TempFromTofLUT = new List<Tuple<double, double>>();
foreach (var item in cordonelTempLut.OrderBy(a => a.RefTempC))
catch (Exception ex)
{
TempFromTofLUT.Add(new Tuple<double, double>(item.AvgTof, item.RefTempC));
}
var sb = new StringBuilder();
foreach (var t in TempFromTofLUT)
{
sb.Append("Tof:");
sb.Append(t.Item1);
sb.Append("=Temp:");
sb.Append(t.Item2);
sb.Append(",");
Meter.WriteLog($"StartTempWatch with LUT faild for meter {pcbid} with ex{ex.Message}");
}
Meter.WriteLog($"Load LUT { sb.ToString() } for meter {pcbid}");
}
catch (Exception ex)
{
Meter.WriteLog($"StartTempWatch with LUT faild for meter {pcbid} with ex{ex.Message}");
}
watchActiv = true;
MeterTempMode = tempMode;
}
watchActiv = true;
MeterTempMode = tempMode;
catch (Exception ex)
{
Log("StartTempWatch" + ex.Message);
}
}
public enum TempMode
@@ -194,6 +194,12 @@ namespace CordonelPreadjustmentUi
{
sb.Append($"{p.Name}={p.GetValue(this, null).ToString()}");
}
sb.Append($"GetTempUsePtOverSps()={GetTempUsePtOverSps().ToString()}");
sb.Append($"GetTempUseTempFlansh()={GetTempUseTempFlansh().ToString()}");
sb.Append($"GetTempUseManualInput()={GetTempUseManualInput().ToString()}");
return sb.ToString();
}
@@ -36,7 +36,19 @@ namespace CordonelPreadjustmentUi.Processes.Actions
{
pp.DebugMessage($"Load Temp {tempmeterctl.Slot} with {MeterStateControl.TempMode.CalcTof}\n");
tempmeterctl.StartTempWatch(MeterStateControl.TempMode.CalcTof);
try
{
tempmeterctl.StartTempWatch(MeterStateControl.TempMode.CalcTof);
}
catch (Exception ex)
{
pp.DebugMessage($"Load Temp error use hand insted");
pp.DebugMessage(ex.Message);
pp.DebugMessage($"Load Temp {tempmeterctl.Slot} with {MeterStateControl.TempMode.Hand}\n");
tempmeterctl.StartTempWatch();
}
}
else
{