Justage für Magflux läuft

This commit is contained in:
Roland Drabesch
2023-06-06 12:15:22 +02:00
parent f8b9091330
commit 7996e270de
5 changed files with 182 additions and 86 deletions
+1 -1
View File
@@ -155,7 +155,7 @@
</site>
<site name="MeterProcessState" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\SZLATEV\source\repos\laa_production\Common\Service\MeterProcessState" />
<virtualDirectory path="/" physicalPath="C:\Users\drabesch_ro\Repo\lab\la_operations\laa_production\Common\Service\MeterProcessState" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:56011:localhost" />
@@ -1,4 +1,5 @@
using Xylem.Common.Logic.ProductionOrderCore.OrderData;
using System.Text;
using Xylem.Common.Logic.ProductionOrderCore.OrderData;
using XylemCommonUiLegacyGenCtl.Enums;
namespace XylemCommonUiLegacyGenCtl.DataPackage
@@ -25,6 +26,53 @@ namespace XylemCommonUiLegacyGenCtl.DataPackage
public MeterTestResults[] meterTestResults { get; set; }
public override string ToString()
{
var sb = new StringBuilder();
sb.AppendLine($"WatingForDecision={WatingForDecision}");
sb.AppendLine($"TempSouce={TempSouce}");
sb.AppendLine($"MeterSize={MeterSize}");
sb.AppendLine($"DelayInSBeforStart={DelayInSBeforStart}");
sb.AppendLine($"AllChanelsRequired={AllChanelsRequired}");
sb.AppendLine($"ProductionMode={ProductionMode}");
foreach (var item in meterTestSettings)
{
if (item == null)
{
continue;
}
sb.AppendLine($"Slot={item.Slot}");
sb.AppendLine($"SerialNr={item.SerialNr}");
sb.AppendLine($"FlowTesting={item.FlowTesting}");
sb.AppendLine($"PreAdjustment={item.PreAdjustment}");
sb.AppendLine($"FlowAdjustment={item.FlowAdjustment}");
sb.AppendLine($"FlowAdjustmentTarget={item.FlowAdjustmentTarget}");
sb.AppendLine($"meterType={item.meterType}");
}
foreach (var item in meterTestResults)
{
if (item == null)
{
continue;
}
sb.AppendLine($"Slot={item.Slot}");
sb.AppendLine($"Sr={item.SerialNr}");
foreach (var flows in item.Results)
{
sb.AppendLine($"MeasuredRefFlowQmPerH={flows.MeasuredRefFlowQmPerH}");
sb.AppendLine($"MeasuredDutFlowQmPerH={flows.MeasuredDutFlowQmPerH}");
}
}
return sb.ToString();
}
}
}
@@ -171,6 +171,7 @@ namespace XylemCommonUiLegacyGenCtl
if (TestsetuptContainer == null)
{
TestsetuptContainer = new TestSetupContainer();
TestsetuptContainer.TempSouce = Enums.TempSouceType.PtOverSps;
TestsetuptContainer.ProductionMode = false;
@@ -311,6 +312,14 @@ namespace XylemCommonUiLegacyGenCtl
MessageBox.Show(ex.Message);
}
Thread.Sleep(1000);
var RetryLeft = 10;
while (meter.GetMeasurementState(0) != Xylem.Common.Metrology.Measurements.Consts.MeasurementStates.IsCompleted && RetryLeft >0)
{
Thread.Sleep(1000);
RetryLeft = RetryLeft - 1;
}
var resU = meter.GetMainMeasurementResult(0, 60);
@@ -429,6 +438,7 @@ namespace XylemCommonUiLegacyGenCtl
public dynamic GetTestSetupContainer()
{
MessageBox.Show(TestsetuptContainer.ToString(), "after PreAjdustemnt GetTestSetupContainer");
return TestsetuptContainer;
}
}
@@ -189,6 +189,7 @@ namespace XylemCommonUiLegacyGenCtl
if (testSetup.meterTestSettings[Slot - 1] == null)
{
System.Windows.Forms.MessageBox.Show("new testresults from setmetertestsettings");
testSetup.meterTestResults[Slot - 1] = new MeterTestResults();
}
+53 -16
View File
@@ -18,7 +18,6 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.Consts;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
@@ -885,6 +884,7 @@ namespace XylemCommonUiLegacyGenCtl
{
if (TestSetupContainer == null)
{
MessageBox.Show("TestSetupContainer is null so add a new one");
TestSetupContainer = new TestSetupContainer();
TestSetupContainer.AllChanelsRequired = true;
TestSetupContainer.meterTestSettings = new MeterTestSettings[10];
@@ -893,6 +893,7 @@ namespace XylemCommonUiLegacyGenCtl
if (!TestSetupContainer.meterTestSettings.Any(f => f != null && f.Slot == slot))
{
MessageBox.Show($"TestSetupContainer has no entrys for Slot {slot}");
TestSetupContainer.meterTestSettings[slot] = new MeterTestSettings() { SerialNr = serialNumber, Slot = slot, FlowAdjustment = true, FlowTesting = true };
TestSetupContainer.meterTestResults[slot] = new MeterTestResults() { SerialNr = serialNumber, Slot = slot, meterType = MeterTypes.MagFlux, Results = new List<Xylem.Common.Hardware.WaterMeter.DataPackages.MeasurementRecords.FlowDeviations>() };
@@ -938,6 +939,16 @@ namespace XylemCommonUiLegacyGenCtl
}
public void MeterDoneWithDetails(Int32 slot, Boolean Succeed)
{
var meter = batch.ListOfMeters.First(f => f.Slot == slot);
if (meter is MagFluxMeter mag)
{
MeterDone(slot, Succeed);
}
else
{
if (!slotLut.ContainsKey(slot))
{
slotLut.Add(slot, "");
@@ -957,7 +968,6 @@ namespace XylemCommonUiLegacyGenCtl
MeterDone(slot, Succeed);
var meter = batch.ListOfMeters.First(f => f.Slot == slot);
if (meter is GenesisMeter gen)
{
slotLut[slot] = gen.LutCrc;
@@ -980,11 +990,13 @@ namespace XylemCommonUiLegacyGenCtl
}
}
}
public void MeterDone(Int32 slot, Boolean Succeed)
{
try
{
setBusy(true, $"Set {slot} LCD");
Task.Factory.StartNew(() =>
{
@@ -995,18 +1007,33 @@ namespace XylemCommonUiLegacyGenCtl
if (meter is MagFluxMeter mag)
{
var sb = new StringBuilder();
if (TestSetupContainer.meterTestSettings.Any(s => s.Slot == slot && s.PreAdjustment))
try
{
var result = TestSetupContainer.meterTestResults.First(s => s.Slot == slot);
var sb = new StringBuilder();
if (TestSetupContainer.meterTestSettings.Any(s => s != null && s.Slot == slot && s.PreAdjustment))
{
//MessageBox.Show($"has meter with Zeroflow {slot}");
var result = TestSetupContainer.meterTestResults.First(s => s != null && s.Slot == slot);
sb.AppendLine($"Results: {result.SerialNr} on ep. {result.Slot}");
foreach (var flowDeviations in result.Results)
{
MessageBox.Show($"RefFlow {flowDeviations.MeasuredRefFlowQmPerH} (for {flowDeviations.RefTimeS} Seconds) vs DutFlow {flowDeviations.MeasuredDutFlowQmPerH} (for {flowDeviations.DutTimeS} Seconds)");
sb.AppendLine($"RefFlow {flowDeviations.MeasuredRefFlowQmPerH} (for {flowDeviations.RefTimeS} Seconds) vs DutFlow {flowDeviations.MeasuredDutFlowQmPerH} (for {flowDeviations.DutTimeS} Seconds)");
}
//MessageBox.Show(sb.ToString());
mag.WriteLog(sb.ToString());
mag.WriteCalibrationTestBench(result.Results);
}
}
catch (Exception ex )
{
MessageBox.Show(ex.Message);
}
@@ -1562,22 +1589,27 @@ namespace XylemCommonUiLegacyGenCtl
}
if (Chnnl == 0)
{
var results = TestSetupContainer.meterTestResults.First(f => f != null && f.Slot == Slot);
try
{
if (results == null)
if (TestSetupContainer.meterTestResults == null)
{
MessageBox.Show("No TestContainer found");
MessageBox.Show("meterTestResults emtpty on getresults");
var countMeters = TestSetupContainer.meterTestSettings?.Count() ?? 10;
TestSetupContainer.meterTestResults = new MeterTestResults[countMeters];
}
else
if (!TestSetupContainer.meterTestResults.Any(f => f != null && f.Slot == Slot))
{
if (results.Results == null)
{
results.Results = new List<Xylem.Common.Hardware.WaterMeter.DataPackages.MeasurementRecords.FlowDeviations>();
MessageBox.Show("meterTestResults not found on getresults");
TestSetupContainer.meterTestResults[Slot - 1].Results = new List<Xylem.Common.Hardware.WaterMeter.DataPackages.MeasurementRecords.FlowDeviations>();
}
if (!results.Results.Any(f => f.MeasuredRefFlowQmPerH == result.Value.RefFlowRateCmPh))
var results = TestSetupContainer.meterTestResults[Slot - 1].Results;
if (!results.Any(f => f.MeasuredRefFlowQmPerH == result.Value.RefFlowRateCmPh))
{
results.Results.Add(new Xylem.Common.Hardware.WaterMeter.DataPackages.MeasurementRecords.FlowDeviations()
results.Add(new Xylem.Common.Hardware.WaterMeter.DataPackages.MeasurementRecords.FlowDeviations()
{
MeasuredRefFlowQmPerH = result.Value.RefFlowRateCmPh ?? 0,
RefTimeS = result.Value.RefTimeS ?? 0,
@@ -1588,6 +1620,12 @@ namespace XylemCommonUiLegacyGenCtl
});
}
}
catch (Exception ex)
{
_logger.Error(ex, $"error on GetResults add testresult Slot={Slot},Chnnl={Chnnl},refVolQm={refVolQm},refTimeS={refTimeS}");
}
}
return new Results(result.Value, sbError);
@@ -2346,7 +2384,6 @@ namespace XylemCommonUiLegacyGenCtl
}
MessageBox.Show(sb.ToString());
TestSetupContainer = vbContainer;
_currentState = BatchState.TestContainerIsReady;
return;