log time no commit

This commit is contained in:
Roland Drabesch 2025-01-21 12:45:31 +01:00
parent e64fd66d3b
commit 6851d0a605
24 changed files with 17547 additions and 16934 deletions

1
.gitignore vendored
View File

@ -399,3 +399,4 @@ FodyWeavers.xsd
*applicationhost.config
/Common/CommonConsole
/Common/Common.v3.ncrunchsolution
/TBF_V2/Sources/TBF/TBF/BenchControl/TestMethods/GenesisCommunication.zip

View File

@ -25,7 +25,15 @@ namespace CordonelAssemblyLine
private static void Model_OnMsgRaise(Object sender, String e)
{
MessageBox.Show(e,"Fehler beim Verheiraten");
if (e == "Zähler verheiratet. Kann zur Prüfstation")
{
MessageBox.Show(e, "Zähler in Ordnung");
}
else
{
MessageBox.Show(e, "Fehler beim Verheiraten");
}
}
private void Window_Loaded(Object sender, RoutedEventArgs e)

View File

@ -123,6 +123,8 @@
<PropertyGroup />
<PropertyGroup />
<PropertyGroup />
<PropertyGroup />
<PropertyGroup />
<PropertyGroup>
<NoWin32Manifest>true</NoWin32Manifest>
</PropertyGroup>

View File

@ -72,7 +72,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
{
tempmeterctl.OverridePassword = falkeItem.Password;
tempmeterctl.OverridePcbId = falkeItem.PcbID;
pp.DebugMessage($"Fixed Tempflansch on Slot {tempmeterctl.Slot} OverridePcbId {tempmeterctl.OverridePcbId }\n");
pp.DebugMessage($"Fixed Tempflansch on Slot {tempmeterctl.Slot} OverridePcbId {tempmeterctl.OverridePcbId }\n");
}
}

View File

@ -95,7 +95,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
Ok = false;
Ok = WriteRegisterSafe(meterctl.Meter, "Percentage", Register.Genesisflow.FirstHitPercent2, FirstHitLevelPercentage);
Ok = WriteRegisterSafe(meterctl.Meter, "Percentage", Register.Genesisflow.FirstHitPercent3, FirstHitLevelPercentage);
if (CheckAbort(Ok, meterctl)) { return Ok; }
#endregion
@ -113,9 +113,9 @@ namespace CordonelPreadjustmentUi.Processes.Actions
bool retryRecord = false;
if (true)
{
if (!meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Get(1).Any())
if (!meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Get(2).Any())
{
pp.StatusLabel = $"No Data for Path {1}. Start one recollect";
pp.StatusLabel = $"No Data for Path {2}. Start one recollect";
retryRecord = true;
}
@ -144,7 +144,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
Ok = true;
#endregion
#region Calculate mean value
UInt16 Path = 1;
UInt16 Path = 2;
var meanVal = meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Get(Path).ToList().Mean();
pp.DebugMessage($"Calculate mean value {meanVal} at {meterctl.Meter.Slot}; PATH{(Path + 1).ToString(pp.Setting.Culture)}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId);

View File

@ -63,7 +63,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
var MaxTimeoutWarnings = 300;
pataDataActivitCheck.Update(null, -1);
Thread.Sleep(1800);
var Path = 1;
var Path = 2;
while (PerformCheck)
{
var offsetRecords = new List<CalibrationRecord>();
@ -89,7 +89,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
pp.StatusLabel = ($"{PredefinedMessages.ZeroflowOffsetAqqFinished(pp.Setting.Culture)} {offsetRecords.Count}/{(pp.Setting.OffsetTestNumberOfLines * 3)}"); // "Wait until data aquisition has finished:"
Thread.Sleep(1800);//
var PathSum = 1;
var PathSum = 2;
var currentCount = offsetRecords.Count(c => c.Channel == PathSum + 1);// immer 2
var oldCound = pataDataActivitCheck.Get(0);// immer 0
if (currentCount <= oldCound + 1)

View File

@ -74,21 +74,21 @@ namespace CordonelPreadjustmentUi.Processes.Actions
if (pp.Setting.doOffsetTest)
{
if (pp.Setting.NumberOfPaths > 0)
{
//if (pp.Setting.NumberOfPaths > 0)
//{
Ok = WriteRegisterSafe(meterctl.Meter, "Zeroflow offset1", Register.Genesisflow.ZeroOffset1, pp.Setting.ZeroOffset1);
if (CheckAbort(Ok, meterctl)) { return Ok; }
}
if (pp.Setting.NumberOfPaths > 1)
{
//}
//if (pp.Setting.NumberOfPaths > 1)
//{
Ok = WriteRegisterSafe(meterctl.Meter, "Zeroflow offset2", Register.Genesisflow.ZeroOffset2, pp.Setting.ZeroOffset2);
if (CheckAbort(Ok, meterctl)) { return Ok; }
}
if (pp.Setting.NumberOfPaths > 2)
{
//}
//if (pp.Setting.NumberOfPaths > 2)
//{
Ok = WriteRegisterSafe(meterctl.Meter, "Zeroflow offset3", Register.Genesisflow.ZeroOffset3, pp.Setting.ZeroOffset3);
if (CheckAbort(Ok, meterctl)) { return Ok; }
}
//}
}
meterctl.Meter.calibrationResult.AddAdditionalLog($"OffsetTestNumberOfLines", pp.Setting.OffsetTestNumberOfLines.ToString());

View File

@ -215,31 +215,31 @@ namespace CordonelPreadjustmentUi.Processes.Actions
#region Get 'TOF offset' registers
if (pp.Setting.NumberOfPaths > 0)
{
byte[] rawResult;
Ok = ReadRegister(putTempIntoMeter.Meter, "TOF offset1", Register.Genesisflow.ToFTempOffset1, out rawResult);
if (CheckAbort(Ok, putTempIntoMeter)) { return Ok; }
if (rawResult != null)
{
var tmp = BitConverter.ToInt32(rawResult, 0);
}
//if (pp.Setting.NumberOfPaths > 0)
//{
// byte[] rawResult;
// Ok = ReadRegister(putTempIntoMeter.Meter, "TOF offset1", Register.Genesisflow.ToFTempOffset1, out rawResult);
// if (CheckAbort(Ok, putTempIntoMeter)) { return Ok; }
// if (rawResult != null)
// {
// var tmp = BitConverter.ToInt32(rawResult, 0);
// }
}
if (pp.Setting.NumberOfPaths > 1)
{
byte[] rawResult;
Ok = ReadRegister(putTempIntoMeter.Meter, "TOF offset2", Register.Genesisflow.ToFTempOffset2, out rawResult);
if (CheckAbort(Ok, putTempIntoMeter)) { return Ok; }
if (rawResult != null)
{
var tmp = BitConverter.ToInt32(rawResult, 0);
}
//}
//if (pp.Setting.NumberOfPaths > 1)
//{
// byte[] rawResult;
// Ok = ReadRegister(putTempIntoMeter.Meter, "TOF offset2", Register.Genesisflow.ToFTempOffset2, out rawResult);
// if (CheckAbort(Ok, putTempIntoMeter)) { return Ok; }
// if (rawResult != null)
// {
// var tmp = BitConverter.ToInt32(rawResult, 0);
// }
}
//}
if (pp.Setting.NumberOfPaths > 2)
{
//if (pp.Setting.NumberOfPaths > 2)
//{
byte[] rawResult;
Ok = ReadRegister(putTempIntoMeter.Meter, "TOF offset3", Register.Genesisflow.ToFTempOffset3, out rawResult);
if (CheckAbort(Ok, putTempIntoMeter)) { return Ok; }
@ -247,7 +247,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
{
var tmp = BitConverter.ToInt32(rawResult, 0);
}
}
//}
#endregion

View File

@ -1,17 +1,15 @@
namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
{
using Applications;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Registers;
using Registers.DataTypes;
using Registers.Json;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using Applications;
using Registers;
using Registers.DataTypes;
using Registers.Json;
using WaterMeterRegisters;
/// <summary>
@ -34,7 +32,7 @@
/// <summary>
/// Ctor
/// </summary>
public GenesisConfigurationReader() {}
public GenesisConfigurationReader() { }
/// <summary>
/// Ctor
@ -70,7 +68,7 @@
.DeserializeObject<IDictionary<String, AppSection>>(configurationJson, SerializerSettings)
?? new Dictionary<String, AppSection>();
}
catch (Exception )
catch (Exception)
{
sections = new Dictionary<String, AppSection>();
}
@ -153,26 +151,35 @@
private static Type GetType(String value)
{
switch (value.ToLower())
try
{
case "bool_t": return typeof(Boolean);
case "rpc": return typeof(Rpc);
case "string": return typeof(String);
case "uint32_t": return typeof(UInt32);
case "time_t": return typeof(TimeT);
case "status_t": return typeof(StatusT);
case "uint16_t": return typeof(UInt16);
case "uint8_t": return typeof(Byte);
case "enum8": return typeof(Enum8);
case "uint64_t": return typeof(UInt64);
case "uint96_t": return typeof(UInt96);
case "uint128_t": return typeof(UInt128);
case "int8_t": return typeof(SByte);
case "int32_t": return typeof(Int32);
case "int64_t": return typeof(Int64);
case "int16_t": return typeof(Int16);
default: throw new Exception($"Type {value} not recognized!");
switch (value.ToLower())
{
case "bool_t": return typeof(Boolean);
case "rpc": return typeof(Rpc);
case "string": return typeof(String);
case "uint32_t": return typeof(UInt32);
case "time_t": return typeof(TimeT);
case "status_t": return typeof(StatusT);
case "uint16_t": return typeof(UInt16);
case "uint8_t": return typeof(Byte);
case "enum8": return typeof(Enum8);
case "uint64_t": return typeof(UInt64);
case "uint96_t": return typeof(UInt96);
case "uint128_t": return typeof(UInt128);
case "int8_t": return typeof(SByte);
case "int32_t": return typeof(Int32);
case "int64_t": return typeof(Int64);
case "int16_t": return typeof(Int16);
default: throw new Exception($"Type {value} not recognized!");
}
}
catch (Exception ex)
{
//throw ex;
return typeof(Boolean);
}
}
}

View File

@ -3,12 +3,13 @@ using System.Linq;
using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages.MeasurementRecords;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig.Const;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Logic.ProductionOrderCore.TestResults;
using Xylem.Common.Metrology.Measurements;
using Xylem.Common.Metrology.Measurements.Consts;
namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
{
partial class GenesisMeter
public partial class GenesisMeter
{
/// <summary>
/// Calibration factors for all channels
@ -18,7 +19,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// <summary>
/// Registers needed to store the calibration for the individual channel
/// </summary>
private readonly String[] _registersToStoreCalibFactor =
private readonly String[] _registersToStoreCalibFactor =
{
Register.Genesisflow.CalFactor1,
Register.Genesisflow.CalFactor2,
@ -72,12 +73,15 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
foreach (var item in _listOfIMeasurement.Where(m => m.GetType() == typeof(CalibrationRecord)))
{
if (!(item is CalibrationMeasurement)) continue;
if (!(item is CalibrationMeasurement))
{
continue;
}
var calib = item as CalibrationMeasurement;
var channel = calib.GetChannel();
if( channel == 0 || channel > MeterConfig.CalibChannels)
if (channel == 0 || channel > MeterConfig.CalibChannels)
{
var message = $"Slot:{Slot}, Channel:{channel} - Calibration channel out of range";
_logger.Warn(message);
@ -87,7 +91,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
_logger.Info($"Slot:{Slot}, Channel:{channel} - Calculate Calibrationfactor Relative(RefVolumeCm:{refVolumeCm}, refTimeS:{refTimeS},reqDeviationPercent:{reqDeviationPercent})");
var calibFactorRel = calib.CalculateCalibFactorRel(refVolumeCm, refTimeS, reqDeviationPercent);
//if the null return indicates an invalid calibration factor the calibFactorX.IsCalculated remains false
if (null == calibFactorRel)
{
@ -96,9 +100,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
throw new ApplicationException(message);
}
_calibFactor[channel-1].BuildMeterCalibFactor(calibFactorRel.Value);
_calibFactor[channel-1].IsCalculated = true;
_calibFactor[channel - 1].BuildMeterCalibFactor(calibFactorRel.Value);
_calibFactor[channel - 1].IsCalculated = true;
_logger.Info($"Slot:{Slot}, Channel:{channel} - New calibration factor({_calibFactor[channel - 1].GetRelativeCalibFactor()}rel/{calibFactorRel})");
@ -109,24 +113,65 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
//plus/minus x% tolerance allowed
calib.CalibFactorTolerancePercent = maxCalibFactorTolerancePercent;
if (calib.IsCalibFactorInTolerance(calibFactorRel.Value)) continue;
if (calib.IsCalibFactorInTolerance(calibFactorRel.Value))
{
continue;
}
var warnMessage = $"Slot:{Slot}, Channel:{channel} - " +
$"Calibration factor is out of range({calibFactorRel.Value}rel)";
_logger.Warn(warnMessage);
throw new ApplicationException(warnMessage);
}
var t = new JustageResults()
{
pcbId = PcbId,
p1Target = reqDeviationPercent,
p1Value = _calibFactor[0].GetMeterRawCalibFactor(),
p2Target = reqDeviationPercent,
p2Value = _calibFactor[1].GetMeterRawCalibFactor(),
p3Target = reqDeviationPercent,
p3Value = _calibFactor[2].GetMeterRawCalibFactor(),
dt = DateTime.UtcNow
};
try
{
var tmpUrl = $"http://10.49.40.25/MeterProcessState/api/TestBench/SetCalibrationValues";
_logger.Info($"Request Url: { tmpUrl}");
//ToDO: Update to service URl
Logic.SoftwareAccessHelper.LocalWebRequest.PostAsJson<JustageResults>(t, tmpUrl);
}
catch (Exception ex)
{
_logger.Error($"Request Url: { ex.Message}");
}
}
/// <inheritdoc />
public void SetCalibFactorsAllChannels(Boolean justLog = false)
{
WriteRegister<Byte>(Register.Genesisflow.SampleRate, 2, checkRegister: true);
WriteRegister<UInt16>(Register.Genesisflow.TriggerIdle, 0x1234, true);
for (var channel = 0; channel < MeterConfig.CalibChannels; channel++)
{
if (_calibFactor[channel].IsCalculated == false) continue;
if (_calibFactor[channel].IsCalculated == false)
{
continue;
}
if (justLog)
{
_logger.Warn($"Slot:{Slot} - Calculated calibration factors but not stored to registers");
@ -134,20 +179,34 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
else
{
var registerRawCalibFactor = _calibFactor[channel].GetMeterRawCalibFactor();
var resultWrite = WriteRegister(_calibFactor[channel].RegisterToStoreCalibFactor,
var resultWrite = WriteRegister(_calibFactor[channel].RegisterToStoreCalibFactor,
registerRawCalibFactor, checkRegister: true);
_logger.Info($"Slot:{Slot}, Channel:{channel} - Stored calibration factor({_registersToStoreCalibFactor[channel]})");
//if (!string.IsNullOrEmpty(SerialNumber) && CurrentActionText.Contains("PG"))
//{
// var pathMain = NLogHelper.GetPath(_logger);
// var pathRaw = NLogHelper.GetPath(((LedSerialPort)StreamingPort).GetRawLogger());
// var basePath = Path.GetDirectoryName(pathMain);
// //
// var testRunString = CurrentActionText.Replace("PG", "");
//
if (resultWrite)
{
_logger.Warn($"Set calibration went wrong {_calibFactor[channel].RegisterToStoreCalibFactor}, with {registerRawCalibFactor}");
}
}
}
WriteRegister(Register.Genesisflow.ResetAccumulators, true);
//WriteRegister<UInt16>(Register.Genesisflow.ForwardArrow, 0, checkRegister: true);
WriteRegister<UInt16>(Register.Genesisflow.StoreCalibration, 1,true);
WriteRegister<UInt16>(Register.Genesisflow.StoreCalibration, 1, true);
_logger.Info($"Slot:{Slot} - StoreCalibration { RegisterConverter.ByteArrayToValue<UInt16>(ReadRegister(Register.Genesisflow.StoreCalibration))}");
WriteRegister<UInt16>(Register.Genesisflow.TriggerActive, 1, true);

View File

@ -124,6 +124,7 @@
<Compile Include="ProgrammingParameters.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestResults\CalibrationResults.cs" />
<Compile Include="TestResults\JustageResults.cs" />
<Compile Include="TestResults\TestBenchResult.cs" />
<Compile Include="TestResults\PressureResultData.cs" />
<Compile Include="TestResults\PressureTestPoints.cs" />

View File

@ -24,13 +24,12 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
[Route("GetLeakDataFull")]
public async Task<HttpResponseMessage> GetLeakDataFull(String PcbId = "" , string Auftrag = "")
[Route("GetMTExport")]
public async Task<HttpResponseMessage> GetMTExport(string Auftrag = "")
{
try
{
var returnPw = "Not assigned";
var resDic = new List<Tuple<string, string>>();
using (var dataAccess = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
@ -40,10 +39,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
query.AppendLine(" inner join Cordonel_PressureTest_He he on pt.CordonelPressureTest_Id = he.CordonelPressureTestHe_TestID ");
query.AppendLine(" left outer join Druckpruefung c on pt.[CordonelPressureTest_PcbId] = c.FabNr ");
query.AppendLine(" where 1 = 1 ");
if (!string.IsNullOrEmpty(PcbId))
{
query.AppendLine($" and pt.[CordonelPressureTest_PcbId] = {PcbId} ");
}
if (!string.IsNullOrEmpty(Auftrag))
{
query.AppendLine($" and pt.[CordonelPressureTest_FertigungsAuftragsNr] = {Auftrag} ");
@ -54,7 +50,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
var dt = dataAccess.ExecuteQuery(query.ToString());
foreach (var item in dt.Select())
{
var sb = new StringBuilder();
try
{
@ -84,7 +80,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
sb.Append("keine Kottmann Prüfung gefunden;;;;;;;");
}
retDic.Add( new Tuple<string,string>(item["CordonelPressureTest_Id"].ToString(), sb.ToString()));
retDic.Add(new Tuple<string, string>(item["CordonelPressureTest_Id"].ToString(), sb.ToString()));
}
catch (Exception ex)
@ -92,7 +88,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
throw;
}
}
@ -152,7 +148,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
}
catch (Exception ex)
{
@ -161,8 +157,120 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
[Route("GetCordonelCalibrationData")]
public async Task<HttpResponseMessage> GetCordonelCalibrationData(String PcbId = "", string Auftrag = "", DateTime? Start = null, DateTime? End = null, int? Testbench = null)
{
try
{
var returnPw = "Not assigned";
var resDic = new List<Tuple<string, string>>();
if (!Start.HasValue)
{
Start = new DateTime(2010, 01, 01);
}
if (!End.HasValue)
{
End = new DateTime(2050, 01, 01);
}
using (var dataAccess = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
StringBuilder query = new StringBuilder();
query.AppendLine(" select ");
query.AppendLine(" m.Seriennummer ");
query.AppendLine(" , aps.AuftragNr ");
query.AppendLine(" , aps.PositionNr ");
query.AppendLine(" ,zDate.[PcbId] ");
query.AppendLine(" ,[MeterSize] ");
query.AppendLine(" ,zDate.Id as PreadjustmentID ");
query.AppendLine(" ,[ZeroOffset1] ");
query.AppendLine(" ,[ZeroOffset2] ");
query.AppendLine(" ,[ZeroOffset3] ");
query.AppendLine(" ,[FirstHitUpdatePeriod] ");
query.AppendLine(" ,[FirstHitShift] ");
query.AppendLine(" ,[FirstHitPercent1] ");
query.AppendLine(" ,[FirstHitPercent2] ");
query.AppendLine(" ,[FirstHitPercent3] ");
query.AppendLine(" ,[ToFTempOffset1] ");
query.AppendLine(" ,[ToFTempOffset2] ");
query.AppendLine(" ,[ToFTempOffset3] ");
query.AppendLine(" ,zDate.[date] as ZeroflowDate ");
query.AppendLine(" ,[successful] ");
query.AppendLine(" , qc.Date as Q3CalibrationDate ");
query.AppendLine(" , qc.P1Cal ");
query.AppendLine(" , qc.P1Offset ");
query.AppendLine(" , qc.P2Cal ");
query.AppendLine(" , qc.P2Offset ");
query.AppendLine(" , qc.P3Cal ");
query.AppendLine(" , qc.P3Offset ");
query.AppendLine(" FROM Genesis_Meter m ");
query.AppendLine(" inner join MapPcbIdToSerialNumber map on m.Seriennummer = map.MapPcbIdToSerialNumber_SerialNumber ");
query.AppendLine(" inner join AuftragPositionSerienNr aps on aps.SerienNr = m.Seriennummer and aps.Wiederholungen = -1 ");
query.AppendLine(" inner join ( ");
query.AppendLine(" SELECT t1.* , t1.DATE AS STARTDATE, case when t2.DATE is null then CURRENT_TIMESTAMP else t2.DATE end AS ENDDATE ");
query.AppendLine(" FROM [Auftrag].[dbo].[CordonelMeterCalibrationResults] t1 ");
query.AppendLine(" LEFT JOIN [Auftrag].[dbo].[CordonelMeterCalibrationResults] t2 ON t2.PcbId = t1.PcbId and t2.DATE = ");
query.AppendLine(" (SELECT MIN(DATE) FROM [Auftrag].[dbo].[CordonelMeterCalibrationResults] t3 WHERE t3.DATE > t1.DATE and t3.PcbId = t1.PcbId) ");
query.AppendLine(" ) as zDate on zDate.PcbId = map.MapPcbIdToSerialNumber_PcbId ");
query.AppendLine(" left outer join Cordonel_Q3Calibration qc on qc.PcbId = zDate.PcbId and qc.Date between zDate.STARTDATE and zDate.ENDDATE ");
query.AppendLine(" order by zDate.[date] desc ");
var dt = dataAccess.ExecuteQuery(query.ToString());
var sb = new StringBuilder();
sb.Append("Seriennummer;AuftragNr;PositionNr;PcbId;MeterSize;PreadjustmentID;ZeroOffset1;ZeroOffset2;ZeroOffset3;FirstHitUpdatePeriod;FirstHitShift;FirstHitPercent1;FirstHitPercent2;FirstHitPercent3;ToFTempOffset1;ToFTempOffset2;ToFTempOffset3;ZeroflowDate;successful;Q3CalibrationDate;P1Cal;P1Offset;P2Cal;P2Offset;P3Cal;P3Offset");
sb.AppendLine();
foreach (var item in dt.Select())
{
try
{
foreach (var cell in item.ItemArray)
{
sb.Append(cell).Append(";");
}
sb.AppendLine();
}
catch (Exception ex)
{
throw;
}
}
HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);
result.Content = new StringContent(sb.ToString());
result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/vnd.ms-excel");
result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment"); //attachment will force download
result.Content.Headers.ContentDisposition.FileName = "CordonelCalibrationData.csv";
return result;
}
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.InternalServerError, ex.ToString() + "<br >" + ex.InnerException.ToString());
}
}
[Route("GetTestDataFull")]
public async Task<HttpResponseMessage> GetTestDataFull(String PcbId = "", string Auftrag = "", DateTime? Start = null, DateTime? End = null)
public async Task<HttpResponseMessage> GetTestDataFull(String PcbId = "", string Auftrag = "", DateTime? Start = null, DateTime? End = null, int? Testbench = null)
{
try
{
@ -194,7 +302,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
query.AppendLine(" pg.Nennweite, ");
query.AppendLine(" idt.Baulaenge, ");
query.AppendLine(" pg.Pruefzeit, ");
query.AppendLine(" PP1_Soll,PP1_Ist,PP1_Ist_V, ");
query.AppendLine(" pf.PP1_Fehler, ");
query.AppendLine(" PP2_Soll,PP2_Ist,PP2_Ist_V, ");
@ -219,12 +327,12 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
for (int p = 1; p <= 3; p++)
{
for (int f = 1; f <= 10 ; f++)
for (int f = 1; f <= 10; f++)
{
query.AppendLine($",pf{p}.PP{f}_Fehler");
}
}
query.AppendLine(" from [Auftrag].[dbo].[AuftragPositionSerienNr] apsn ");
query.AppendLine(" inner join [Auftrag].[dbo].[AuftragPosition_Gesamt] apg on apg.AuftragNr = apsn.AuftragNr and apg.PositionNr = apsn.PositionNr and apg.Ort = 'L2' ");
@ -257,19 +365,26 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
query.AppendLine(" inner join [Auftrag].[dbo].[AuftragPositionSerienNr] apsn on apsn.SerienNr = [MapPcbIdToSerialNumber_SerialNumber] and apsn.SerienNr not in (20702497,20702499,20717438) ");
query.AppendLine(" ");
query.AppendLine(" inner join[Auftrag].[dbo].[AuftragPosition_Gesamt] apg on apg.AuftragNr = apsn.AuftragNr and apg.PositionNr = apsn.PositionNr and apg.Ort = 'L2' ");
query.AppendLine(" inner join[Auftrag].[dbo].[Pruefgang] pg on apsn.[Pruefgangnr] = pg.PruefgangNr and pg.PruefstationNr in (2016,2015) ");
query.AppendLine(" inner join[Auftrag].[dbo].[Pruefgang] pg on apsn.[Pruefgangnr] = pg.PruefgangNr ");
if (Testbench.HasValue)
{
query.AppendLine($" and pg.PruefstationNr in ({Testbench.Value}) ");
}
query.AppendLine(" inner join[Auftrag].[dbo].Prueffehler pf on pg.[Pruefgangnr] = pf.PruefgangNr and pf.SerienNr = [MapPcbIdToSerialNumber_SerialNumber] ");
query.AppendLine(" ");
query.AppendLine($" where pg.Datum >= '{Start}' and pg.Datum <= '{End}' ");
query.AppendLine(" group by [MapPcbIdToSerialNumber_SerialNumber] ");
query.AppendLine(" ) ");
query.AppendLine(" ");
// query.AppendLine(" and pf.PP3_Fehler is not null ");
// query.AppendLine(" and pf.PP3_Fehler is not null ");
query.AppendLine(" ");
query.AppendLine(" order by apsn.SerienNr desc, apsn.Wiederholungen asc ");
var dt = dataAccess.ExecuteQuery(query.ToString());
var sb = new StringBuilder();
@ -304,7 +419,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
{
sb.Append(cell).Append(";");
}
sb.AppendLine();
sb.AppendLine();
}

View File

@ -1335,6 +1335,64 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
return this.NotFound();
}
if (result.CalFactor1 == 15625 && result.CalFactor2 == 15625 && result.CalFactor3 == 15625)
{
using (var dataacces = new SqlDataAccess(GlobalConfig.ConnectionString.Value))
{
var sbCal = new StringBuilder();
sbCal.AppendLine(" select map.MapPcbIdToSerialNumber_PcbId, v1.Value as Cal1, v2.Value as Cal2, v3.Value as Cal3 from MapPcbIdToSerialNumber map ");
sbCal.AppendLine(" ");
sbCal.AppendLine(" inner join ");
sbCal.AppendLine(" ( ");
sbCal.AppendLine(" select map.MapPcbIdToSerialNumber_PcbId as mPcbid, max(c1.ID)as M1,max(c2.ID) as M2, max(c3.ID) as m3 from MapPcbIdToSerialNumber map ");
sbCal.AppendLine(" left outer join GenesisMeterRegisterHistory c1 on c1.Address = '0F-0D' and map.MapPcbIdToSerialNumber_PcbId =c1.PcbId ");
sbCal.AppendLine(" left outer join GenesisMeterRegisterHistory c2 on c2.Address = '0F-0E' and map.MapPcbIdToSerialNumber_PcbId =c2.PcbId ");
sbCal.AppendLine(" left outer join GenesisMeterRegisterHistory c3 on c3.Address = '0F-0F' and map.MapPcbIdToSerialNumber_PcbId =c3.PcbId ");
sbCal.AppendLine($" where map.MapPcbIdToSerialNumber_PcbId = '{pcbId}' ");
sbCal.AppendLine(" group by MapPcbIdToSerialNumber_PcbId ) as maxT ");
sbCal.AppendLine(" on mPcbid = map.MapPcbIdToSerialNumber_PcbId ");
sbCal.AppendLine(" ");
sbCal.AppendLine(" inner join GenesisMeterRegisterHistory v1 on v1.ID = M1 ");
sbCal.AppendLine(" inner join GenesisMeterRegisterHistory v2 on v2.ID = M2 ");
sbCal.AppendLine(" inner join GenesisMeterRegisterHistory v3 on v3.ID = M3 ");
var dt = dataacces.ExecuteQuery(sbCal.ToString());
foreach (var item in dt.Select())
{
var strC1 = item["Cal1"].ToString();
string strc1Coor = "";
foreach (String hex in strC1.Split('-').Reverse().ToArray())
{
strc1Coor += hex;
}
result.CalFactor1 = Convert.ToUInt16(strc1Coor, 16);
var strC2 = item["Cal2"].ToString();
string strc2Coor = "";
foreach (String hex in strC2.Split('-').Reverse().ToArray())
{
strc2Coor += hex;
}
result.CalFactor2 = Convert.ToUInt16(strc2Coor, 16);
var strC3 = item["Cal3"].ToString();
string strc3Coor = "";
foreach (String hex in strC3.Split('-').Reverse().ToArray())
{
strc3Coor += hex;
}
result.CalFactor3 = Convert.ToUInt16(strc3Coor, 16);
}
}
}
return this.Json(result);
}
}

View File

@ -69,7 +69,47 @@
return this.BadRequest("Invalid data.");
}
[Route("SetCalibrationValues"), HttpPost]
public IHttpActionResult SetCalibrationValues([FromBody] JustageResults val)
{
var rowsAffected = SQLConnection
.CreateSQLConnection(ConnectionString.Value)
.CreateCommand($@"
INSERT INTO[dbo].[Cordonel_Q3Calibration]
([PcbId]
,[P1Offset]
,[P1Cal]
,[P2Offset]
,[P2Cal]
,[P3Offset]
,[P3Cal]
,[Date])
VALUES (@{nameof(JustageResults.pcbId)}
, @{nameof(JustageResults.p1Target)}
, @{nameof(JustageResults.p1Value)}
, @{nameof(JustageResults.p2Target)}
, @{nameof(JustageResults.p2Value)}
, @{nameof(JustageResults.p3Target)}
, @{nameof(JustageResults.p3Value)}
, @{nameof(JustageResults.dt)})")
.SetParameter(nameof(JustageResults.pcbId), int.Parse(val.pcbId))
.SetParameter(nameof(JustageResults.p1Target), val.p1Target)
.SetParameter(nameof(JustageResults.p1Value), ((Int32)val.p1Value))
.SetParameter(nameof(JustageResults.p2Target), val.p2Target)
.SetParameter(nameof(JustageResults.p2Value), ((Int32)val.p2Value))
.SetParameter(nameof(JustageResults.p3Target), val.p3Target)
.SetParameter(nameof(JustageResults.p3Value), ((Int32)val.p3Value))
.SetParameter(nameof(JustageResults.dt), val.dt)
.ExecuteNonQuery();
if (rowsAffected == 1)
{
return this.Ok();
}
return this.BadRequest("Invalid data.");
}
/// <summary>
/// Get SerialNumber from PcbID
/// </summary>

View File

@ -1 +1 @@
1babc7d629fd8c486aff20f4990c117c2e58a68f
65d75c3322f8a137c69963cfdc0cb6f1ffacf62a

View File

@ -35,6 +35,7 @@
this.btnWrite = new System.Windows.Forms.Button();
this.btnRead = new System.Windows.Forms.Button();
this.btnLogout = new System.Windows.Forms.Button();
this.btnSwichtPressure = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// lblState
@ -104,11 +105,22 @@
this.btnLogout.UseVisualStyleBackColor = true;
this.btnLogout.Click += new System.EventHandler(this.btnLogout_Click);
//
// btnSwichtPressure
//
this.btnSwichtPressure.Location = new System.Drawing.Point(24, 238);
this.btnSwichtPressure.Name = "btnSwichtPressure";
this.btnSwichtPressure.Size = new System.Drawing.Size(129, 52);
this.btnSwichtPressure.TabIndex = 13;
this.btnSwichtPressure.Text = "Drucksensor";
this.btnSwichtPressure.UseVisualStyleBackColor = true;
this.btnSwichtPressure.Click += new System.EventHandler(this.btnSwichtPressure_Click);
//
// FrmQsTool
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(587, 450);
this.Controls.Add(this.btnSwichtPressure);
this.Controls.Add(this.btnLogout);
this.Controls.Add(this.lblState);
this.Controls.Add(this.btnConnect);
@ -133,5 +145,6 @@
private System.Windows.Forms.Button btnLogout;
private System.Windows.Forms.Button btnWrite;
private System.Windows.Forms.Button btnRead;
private System.Windows.Forms.Button btnSwichtPressure;
}
}

View File

@ -229,6 +229,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
{
_meterBatch.RemoveAllMeters();
_currentGenesis = new GenesisMeter();
btnSwichtPressure.Text = "Drucksensor";
//_currentGenesis.IsDevelopmentUsage = true; //Make sure to set this before login
try
{
@ -247,6 +248,17 @@ namespace Xylem.Common.Ui.GenesisToolBox
if (_currentGenesis.IsLoggedOn)
{
lblState.Text = _currentGenesis.PcbId;
var pressureReadOut = RegisterConverter.ByteArrayToValue<Boolean>(_currentGenesis.ReadRegister("METROLOGYASST_PressurePresent"));
if (pressureReadOut)
{
btnSwichtPressure.Text = "Drucksensor ist vorhanden. Ändern?";
}
else
{
btnSwichtPressure.Text = "Drucksensor ist NICHT vorhanden. Ändern?";
}
}
else
{
@ -285,6 +297,18 @@ namespace Xylem.Common.Ui.GenesisToolBox
{
_meterBatch.Dispose();
}
private void btnSwichtPressure_Click(Object sender, EventArgs e)
{
if (_currentGenesis != null && _currentGenesis.IsLoggedOn)
{
var pressureReadOut = RegisterConverter.ByteArrayToValue<Boolean>(_currentGenesis.ReadRegister("METROLOGYASST_PressurePresent"));
var result = _currentGenesis.WriteRegister("METROLOGYASST_PressurePresent", !pressureReadOut, true,true);
_currentGenesis.StoreAllConfigurations();
}
}
}
}

View File

@ -56,9 +56,11 @@
this.groupBox1.Controls.Add(this.rbMeasurement);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.cblSlots);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Location = new System.Drawing.Point(16, 15);
this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(238, 105);
this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.groupBox1.Size = new System.Drawing.Size(317, 129);
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Connection";
@ -67,9 +69,10 @@
// cbRequest
//
this.cbRequest.AutoSize = true;
this.cbRequest.Location = new System.Drawing.Point(6, 82);
this.cbRequest.Location = new System.Drawing.Point(8, 101);
this.cbRequest.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.cbRequest.Name = "cbRequest";
this.cbRequest.Size = new System.Drawing.Size(66, 17);
this.cbRequest.Size = new System.Drawing.Size(83, 21);
this.cbRequest.TabIndex = 11;
this.cbRequest.Text = "Request";
this.cbRequest.UseVisualStyleBackColor = true;
@ -77,9 +80,10 @@
// rbFlowCalibration
//
this.rbFlowCalibration.AutoSize = true;
this.rbFlowCalibration.Location = new System.Drawing.Point(100, 63);
this.rbFlowCalibration.Location = new System.Drawing.Point(133, 78);
this.rbFlowCalibration.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.rbFlowCalibration.Name = "rbFlowCalibration";
this.rbFlowCalibration.Size = new System.Drawing.Size(99, 17);
this.rbFlowCalibration.Size = new System.Drawing.Size(128, 21);
this.rbFlowCalibration.TabIndex = 10;
this.rbFlowCalibration.Text = "Flow Calibration";
this.rbFlowCalibration.UseVisualStyleBackColor = true;
@ -88,9 +92,10 @@
//
this.rbMeasurement.AutoSize = true;
this.rbMeasurement.Checked = true;
this.rbMeasurement.Location = new System.Drawing.Point(9, 63);
this.rbMeasurement.Location = new System.Drawing.Point(12, 78);
this.rbMeasurement.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.rbMeasurement.Name = "rbMeasurement";
this.rbMeasurement.Size = new System.Drawing.Size(89, 17);
this.rbMeasurement.Size = new System.Drawing.Size(115, 21);
this.rbMeasurement.TabIndex = 9;
this.rbMeasurement.TabStop = true;
this.rbMeasurement.Text = "Measurement";
@ -99,18 +104,20 @@
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 23);
this.label1.Location = new System.Drawing.Point(8, 28);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(36, 13);
this.label1.Size = new System.Drawing.Size(49, 17);
this.label1.TabIndex = 6;
this.label1.Text = "Slot(s)";
//
// cblSlots
//
this.cblSlots.FormattingEnabled = true;
this.cblSlots.Location = new System.Drawing.Point(48, 19);
this.cblSlots.Location = new System.Drawing.Point(64, 23);
this.cblSlots.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.cblSlots.Name = "cblSlots";
this.cblSlots.Size = new System.Drawing.Size(114, 34);
this.cblSlots.Size = new System.Drawing.Size(151, 38);
this.cblSlots.TabIndex = 4;
this.cblSlots.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.cblSlots_ItemCheck);
this.cblSlots.SelectedIndexChanged += new System.EventHandler(this.cblSlots_SelectedIndexChanged);
@ -124,27 +131,31 @@
this.groupBox2.Controls.Add(this.btnMeasurementStop);
this.groupBox2.Controls.Add(this.btnMeasurementPreparation);
this.groupBox2.Controls.Add(this.btnMeasurementStart);
this.groupBox2.Location = new System.Drawing.Point(282, 12);
this.groupBox2.Location = new System.Drawing.Point(376, 15);
this.groupBox2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(656, 105);
this.groupBox2.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.groupBox2.Size = new System.Drawing.Size(875, 129);
this.groupBox2.TabIndex = 10;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Control";
//
// btnGetResults
//
this.btnGetResults.Location = new System.Drawing.Point(463, 13);
this.btnGetResults.Location = new System.Drawing.Point(617, 16);
this.btnGetResults.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btnGetResults.Name = "btnGetResults";
this.btnGetResults.Size = new System.Drawing.Size(83, 80);
this.btnGetResults.Size = new System.Drawing.Size(111, 98);
this.btnGetResults.TabIndex = 12;
this.btnGetResults.Text = "Store Calibration";
this.btnGetResults.UseVisualStyleBackColor = true;
//
// btnStoreCal
//
this.btnStoreCal.Location = new System.Drawing.Point(564, 13);
this.btnStoreCal.Location = new System.Drawing.Point(752, 16);
this.btnStoreCal.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btnStoreCal.Name = "btnStoreCal";
this.btnStoreCal.Size = new System.Drawing.Size(83, 80);
this.btnStoreCal.Size = new System.Drawing.Size(111, 98);
this.btnStoreCal.TabIndex = 11;
this.btnStoreCal.Text = "Store Calibration";
this.btnStoreCal.UseVisualStyleBackColor = true;
@ -152,16 +163,18 @@
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(284, 36);
this.textBox1.Location = new System.Drawing.Point(379, 44);
this.textBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(97, 20);
this.textBox1.Size = new System.Drawing.Size(128, 22);
this.textBox1.TabIndex = 10;
//
// btnUpdate
//
this.btnUpdate.Location = new System.Drawing.Point(188, 19);
this.btnUpdate.Location = new System.Drawing.Point(251, 23);
this.btnUpdate.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btnUpdate.Name = "btnUpdate";
this.btnUpdate.Size = new System.Drawing.Size(77, 80);
this.btnUpdate.Size = new System.Drawing.Size(103, 98);
this.btnUpdate.TabIndex = 9;
this.btnUpdate.Text = "SetBatchInfos";
this.btnUpdate.UseVisualStyleBackColor = true;
@ -169,9 +182,10 @@
//
// btnMeasurementStop
//
this.btnMeasurementStop.Location = new System.Drawing.Point(392, 13);
this.btnMeasurementStop.Location = new System.Drawing.Point(523, 16);
this.btnMeasurementStop.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btnMeasurementStop.Name = "btnMeasurementStop";
this.btnMeasurementStop.Size = new System.Drawing.Size(65, 80);
this.btnMeasurementStop.Size = new System.Drawing.Size(87, 98);
this.btnMeasurementStop.TabIndex = 8;
this.btnMeasurementStop.Text = "Stop";
this.btnMeasurementStop.UseVisualStyleBackColor = true;
@ -179,9 +193,10 @@
//
// btnMeasurementPreparation
//
this.btnMeasurementPreparation.Location = new System.Drawing.Point(21, 19);
this.btnMeasurementPreparation.Location = new System.Drawing.Point(28, 23);
this.btnMeasurementPreparation.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btnMeasurementPreparation.Name = "btnMeasurementPreparation";
this.btnMeasurementPreparation.Size = new System.Drawing.Size(78, 80);
this.btnMeasurementPreparation.Size = new System.Drawing.Size(104, 98);
this.btnMeasurementPreparation.TabIndex = 6;
this.btnMeasurementPreparation.Text = "Preparation";
this.btnMeasurementPreparation.UseVisualStyleBackColor = true;
@ -189,9 +204,10 @@
//
// btnMeasurementStart
//
this.btnMeasurementStart.Location = new System.Drawing.Point(105, 19);
this.btnMeasurementStart.Location = new System.Drawing.Point(140, 23);
this.btnMeasurementStart.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btnMeasurementStart.Name = "btnMeasurementStart";
this.btnMeasurementStart.Size = new System.Drawing.Size(77, 80);
this.btnMeasurementStart.Size = new System.Drawing.Size(103, 98);
this.btnMeasurementStart.TabIndex = 7;
this.btnMeasurementStart.Text = "Start";
this.btnMeasurementStart.UseVisualStyleBackColor = true;
@ -199,9 +215,10 @@
//
// btnCheckAll
//
this.btnCheckAll.Location = new System.Drawing.Point(1167, 123);
this.btnCheckAll.Location = new System.Drawing.Point(1556, 151);
this.btnCheckAll.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btnCheckAll.Name = "btnCheckAll";
this.btnCheckAll.Size = new System.Drawing.Size(90, 67);
this.btnCheckAll.Size = new System.Drawing.Size(120, 82);
this.btnCheckAll.TabIndex = 14;
this.btnCheckAll.Text = "CheckBatch";
this.btnCheckAll.UseVisualStyleBackColor = true;
@ -211,29 +228,32 @@
//
this.ctlBatch.AutoSize = true;
this.ctlBatch.BackColor = System.Drawing.SystemColors.Control;
this.ctlBatch.Location = new System.Drawing.Point(12, 146);
this.ctlBatch.MinimumSize = new System.Drawing.Size(660, 440);
this.ctlBatch.Location = new System.Drawing.Point(16, 180);
this.ctlBatch.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.ctlBatch.MinimumSize = new System.Drawing.Size(880, 542);
this.ctlBatch.Name = "ctlBatch";
this.ctlBatch.Size = new System.Drawing.Size(697, 463);
this.ctlBatch.Size = new System.Drawing.Size(1409, 570);
this.ctlBatch.TabIndex = 15;
//
// preAdjWr1
//
this.preAdjWr1.Location = new System.Drawing.Point(727, 179);
this.preAdjWr1.Location = new System.Drawing.Point(969, 220);
this.preAdjWr1.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.preAdjWr1.Name = "preAdjWr1";
this.preAdjWr1.Size = new System.Drawing.Size(976, 658);
this.preAdjWr1.Size = new System.Drawing.Size(1301, 810);
this.preAdjWr1.TabIndex = 16;
//
// FrmLegacyTestApp
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1378, 697);
this.ClientSize = new System.Drawing.Size(1837, 858);
this.Controls.Add(this.preAdjWr1);
this.Controls.Add(this.ctlBatch);
this.Controls.Add(this.btnCheckAll);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.Name = "FrmLegacyTestApp";
this.Text = "FrmLegacyTestApp";
this.Load += new System.EventHandler(this.TestForm_Load);

View File

@ -22,6 +22,7 @@ using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisStatus;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
using Xylem.Common.Logic.ProductionOrderCore.TestResults;
using Xylem.Common.Logic.ServiceCore;
using Xylem.Common.Logic.SoftwareAccessHelper;
using Xylem.Common.Utils.Logging;
@ -2043,6 +2044,38 @@ namespace Xylem.Common.Ui.GenesisToolBox
{
_currentGenesis = ((GenesisMeter)me);
var t = new JustageResults()
{
pcbId = _currentGenesis.PcbId,
p1Target = 0,
p1Value = RegisterConverter.ByteArrayToValue<ushort>(_currentGenesis.ReadRegister(Register.Genesisflow.CalFactor1)),
p2Target = 0,
p2Value = RegisterConverter.ByteArrayToValue<ushort>(_currentGenesis.ReadRegister(Register.Genesisflow.CalFactor2)),
p3Target = 0,
p3Value = RegisterConverter.ByteArrayToValue<ushort>(_currentGenesis.ReadRegister(Register.Genesisflow.CalFactor3)),
dt = DateTime.UtcNow
};
try
{
var tmpUrl = $"http://10.49.40.25/MeterProcessState/api/TestBench/SetCalibrationValues";
//ToDO: Update to service URl
Logic.SoftwareAccessHelper.LocalWebRequest.PostAsJson<JustageResults>(t, tmpUrl);
}
catch (Exception ex)
{
}
var genesisStatus = new GenesisStatus();
if (GenesisStatusHandler.BuildLifeTimeInformation(_currentGenesis, genesisStatus))
{

View File

@ -62,7 +62,7 @@ namespace XylemCommonUiLegacyGenCtl
/// <param name="refError">only for GUI -> </param>
/// <param name="isAdjustment">if this test point is an calibration (other test mode) </param>
/// <param name="IsFlyingStartStop">Just for logging (Test run against scale or ref meter)</param>
void AddAllMeters(string meterDn = "-", double refPulseValence = 0.0, double predictedQFlow = 0.0, double predictedTs = 0.0, double refError = 0.0, bool isAdjustment = false, bool IsFlyingStartStop = true);
void AddAllMeters(string meterDn = "-", double refPulseValence = 0.0, double predictedQFlow = 0.0, double predictedTs = 0.0, double refError = 0.0, bool isAdjustment = false, bool IsFlyingStartStop = true, int TestRunNr = 0);
/// <summary>

View File

@ -308,15 +308,15 @@ namespace XylemCommonUiLegacyGenCtl
TestsetuptContainer.meterTestResults = new MeterTestResults[10];
int WaitTimeM = 5;
wrappedControl.StatusLabel("MagFlux Zeroflow is running");
int WaitTimeS = TestsetuptContainer.DelayInSBeforStart;
wrappedControl.StatusLabel($"MagFlux Zeroflow is running for {WaitTimeS}");
var Start = DateTimeOffset.UtcNow;
var End = Start.AddMinutes(WaitTimeM);
var End = Start.AddSeconds(WaitTimeS);
while (End > DateTimeOffset.UtcNow)
{
wrappedControl.PushProgressBars(WaitTimeM * 60, Start, WaitTimeM * 60, Start);
Thread.Sleep(1000);
wrappedControl.PushProgressBars(WaitTimeS, Start, WaitTimeS, Start);
Thread.Sleep(500);
}
try
{
@ -325,44 +325,65 @@ namespace XylemCommonUiLegacyGenCtl
foreach (var meter in meterBatch.ListOfMeters)
{
try
if (meter is MagFluxMeter mfMeter)
{
meter.StopMeasurement();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Thread.Sleep(1000);
var RetryLeft = 10;
while (meter.GetMeasurementState(0) != Xylem.Common.Metrology.Measurements.Consts.MeasurementStates.IsCompleted && RetryLeft > 0)
{
try
{
mfMeter.StopMeasurement();
}
catch (Exception ex)
{
MessageBox.Show("Meter Stop:" + ex.Message);
}
Thread.Sleep(1000);
RetryLeft = RetryLeft - 1;
var RetryLeft = 10;
while (mfMeter.GetMeasurementState(0) != Xylem.Common.Metrology.Measurements.Consts.MeasurementStates.IsCompleted && RetryLeft > 0)
{
Thread.Sleep(1000);
RetryLeft = RetryLeft - 1;
}
var resU = meter.GetMainMeasurementResult(0, WaitTimeS);
try
{
TestsetuptContainer.meterTestResults[meter.Slot - 1] = new MeterTestResults();
TestsetuptContainer.meterTestResults[meter.Slot - 1].Results = new List<Xylem.Common.Hardware.WaterMeter.DataPackages.MeasurementRecords.FlowDeviations>();
TestsetuptContainer.meterTestResults[meter.Slot - 1].meterType = MeterTypes.MagFlux;
TestsetuptContainer.meterTestResults[meter.Slot - 1].Slot = meter.Slot;
TestsetuptContainer.meterTestResults[meter.Slot - 1].SerialNr = meter.SerialNumber;
TestsetuptContainer.meterTestResults[meter.Slot - 1].Results.Add(new Xylem.Common.Hardware.WaterMeter.DataPackages.MeasurementRecords.FlowDeviations() { RefTimeS = 60, MeasuredRefFlowQmPerH = 0, RequierdTimeS = 60, RequierdFlowQmPerH = 0, MeasuredDutFlowQmPerH = resU.DutFlowRateCmPh.Value, DutTimeS = resU.DutTimeS });
}
catch (Exception ex)
{
MessageBox.Show("Meter add results:" + ex.Message);
}
mfMeter.Logout();
try
{
mfMeter.DisposeMeter();
}
catch (Exception)
{
}
}
var resU = meter.GetMainMeasurementResult(0, WaitTimeM * 60);
TestsetuptContainer.meterTestResults[meter.Slot - 1] = new MeterTestResults();
TestsetuptContainer.meterTestResults[meter.Slot - 1].Results = new List<Xylem.Common.Hardware.WaterMeter.DataPackages.MeasurementRecords.FlowDeviations>();
TestsetuptContainer.meterTestResults[meter.Slot - 1].meterType = MeterTypes.MagFlux;
TestsetuptContainer.meterTestResults[meter.Slot - 1].Slot = meter.Slot;
TestsetuptContainer.meterTestResults[meter.Slot - 1].SerialNr = meter.SerialNumber;
TestsetuptContainer.meterTestResults[meter.Slot - 1].Results.Add(new Xylem.Common.Hardware.WaterMeter.DataPackages.MeasurementRecords.FlowDeviations() { RefTimeS = 60, MeasuredRefFlowQmPerH = 0, RequierdTimeS = 60, RequierdFlowQmPerH = 0, MeasuredDutFlowQmPerH = resU.DutFlowRateCmPh.Value, DutTimeS = resU.DutTimeS });
meter.Logout();
meter.DisposeMeter();
meterBatch.RemoveMeter(meter);
}
}
catch (Exception ex)
{
_logger.Fatal(ex);
MessageBox.Show(ex.Message);
}
meterBatch.Dispose();

Binary file not shown.

View File

@ -823,7 +823,7 @@ namespace XylemCommonUiLegacyGenCtl
}
public void AddAllMeters(String meterDn = "-", Double refPulseValence = 0.0, Double predictedQFlow = 0.0,
Double predictedTs = 0.0, Double refError = 0.0, Boolean isAdjustment = false, Boolean isFlyingStartStop = true)
Double predictedTs = 0.0, Double refError = 0.0, Boolean isAdjustment = false, Boolean isFlyingStartStop = true, int testRunNr = 0)
{
try
{