This commit is contained in:
Roland Drabesch
2023-01-24 10:12:01 +01:00
80 changed files with 2162 additions and 1674 deletions
+2 -2
View File
@@ -14,5 +14,5 @@ using System.Reflection;
//[assembly: AssemblyVersion("1.2.*.0")]
[assembly: AssemblyVersion("2.3.4.*")]
[assembly: AssemblyFileVersion("2.3.4.0")]
[assembly: AssemblyVersion("2.3.5.*")]
[assembly: AssemblyFileVersion("2.3.5.0")]
+1
View File
@@ -47,6 +47,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=licence/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Metrology/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=METROLOGYASST/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=mettbl/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=PCBID/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Preadjustment/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=prot/@EntryIndexedValue">True</s:Boolean>
+1 -1
View File
@@ -27,7 +27,7 @@
<s:Boolean x:Key="/Default/Environment/ExcludedFiles/FilesAndFoldersToSkip/=1057AD21_002DBA22_002D4CAB_002DB3FE_002D88C5C9980E6A_002Fd_003AScripts_002Ff_003Ajquery_002D1_002E10_002E2_002Eintellisense_002Ejs/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/Environment/Hierarchy/Build/SolBuilderDuo/UseMsbuildSolutionBuilder/@EntryValue">NewVersion</s:String>
<s:Boolean x:Key="/Default/Environment/Hierarchy/EntityFrameworkOptions/IsAlreadyNotifiedAboutEntityFramework/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/Environment/Highlighting/HighlightingSourceSnapshotLocation/@EntryValue">C:\Users\Thomas\AppData\Local\Temp\JetBrains\ReSharperPlatformVs15\vAny_33007af5\CoverageData\_Common.-1885154465\Snapshot\snapshot.utdcvr</s:String>
@@ -947,10 +947,13 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// <remarks date="2022-Dec-12" author="T.Wiedebusch">
/// - PcbId unknown returns immediately.
/// </remarks>
/// <remarks date="2023-Jan-19" author="T.Wiedebusch">
/// - Password had been reset to empty string if read from file, corrected!
/// </remarks>
private String GetPassword()
{
var url = ServiceUrls.GenesisGetPasswordServiceUrl();
String password;
var password = "";
//without PCB ID it is not possible to login,
//but if it is already assigned to this Gensis, don't read it again
@@ -966,7 +969,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
}
}
url += PcbId;
@@ -993,16 +995,14 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
$"URL({url}), Error({ex.Message})");
if (File.Exists(ProgramConfig.OfflineInfoFile))
{
var listOfOfflinePasswords = JsonConvert.DeserializeObject<List<OfflinePasswordItem>>(File.ReadAllText(ProgramConfig.OfflineInfoFile));
var listOfOfflinePasswords = JsonConvert.DeserializeObject<List<OfflinePasswordItem>>(
File.ReadAllText(ProgramConfig.OfflineInfoFile));
password = listOfOfflinePasswords.First(x => x.PcbId == PcbId).Password;
if (!string.IsNullOrEmpty(password))
{
_logger.Info($"Slot:{Slot} - Got password from password file!");
}
}
password = "";
}
return password;
@@ -1053,7 +1053,8 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// </remarks>
public Boolean ReLogin()
{
if (IsLoggedOn) return true;
if (IsLoggedOn)
return true;
return string.IsNullOrEmpty(_password) ? Login() : Login(_password);
}
@@ -1175,7 +1176,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// <returns>converted version to string </returns>
public static String BuildFwVersionString(Int32? version)
{
return version == null ? "0.00" : $@"{version / 100}.{version % 100 :D2}";
return version == null ? "0.00" : $@"{version / 100}.{version % 100:D2}";
}
/// <summary>
@@ -1219,6 +1220,61 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// </summary>
public Byte MetrologyUpgradePermission;
/// <summary>
/// Check region and size.
/// After reading the version, all valid registers are going to be selected.
/// </summary>
/// <remarks date="2023-Jan-19" author="Thomas Wiedebusch">
/// - Initial, extracted from <see cref="ReadMeterFirmwareAndAssignRegisters"/>
/// </remarks>
public void CheckRegionSizeLutCrc()
{
//read metrology lookup table CRC
try
{
var lutCrcRaw = ReadRegister(Register.Genesisflow.LookupFileCrc);
if (lutCrcRaw != null)
{
var lutCrc = RegisterConverter.ConvertTo<UInt32>(lutCrcRaw);
LutCrc = $@"0x{lutCrc:X4}";
}
}
catch (Exception)
{
// ignored
}
//read meter size
MeterSize = MeterSizeConverter.ConvertMeterSizeEnumToSizeName((MeterSize)RegisterConverter.ConvertTo<Byte>(
ReadRegister(Register.Genesisflow.MeterSize)));
//read radio frequency
Region = "NA";
RadioFrequencyMhz = null;
try
{
var radioFrequencyRaw = ReadRegister(Register.Sensusradio.FrequencyIndicator);
if (radioFrequencyRaw != null )
{
Region = "EMEA";
RadioFrequencyMhz = RegisterConverter.ConvertTo<Int32>(radioFrequencyRaw);
}
}
catch (Exception)
{
// ignored
}
// check meter size string contains "DN", because if "US" it cannot be an EMEA version
if ((Region.Contains("NA") && MeterSize.Contains("DN")) ||
(Region.Contains("EMEA") && MeterSize.Contains("US")))
{
Region = "?";
MeterSize = "?";
LutCrc = "?";
}
}
/// <summary>
/// Reading all applications which can be found in the configuration.json and have been stored
/// to the meter register dictionary in advance.
@@ -1245,6 +1301,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// - RadioFrequencyMhz introduced as Int32? (null if "NA" region or not installed),
/// - LutCrc from String to Int32?.
/// </remarks>
/// <remarks date="2023-Jan-16" author="Thomas Wiedebusch">
/// - Checked meter size string for "DN", than it cannot be an EMEA version.
/// </remarks>
private void ReadMeterFirmwareAndAssignRegisters()
{
//avoid overwriting of list if this already exits
@@ -1312,29 +1371,12 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
});
}
CheckRegionSizeLutCrc();
//read metrology upgrade permission
MetrologyUpgradePermission = RegisterConverter.ConvertTo<Byte>(
ReadRegister(Register.System.MetrologyUpgradePermission));
//read metrology lookup table CRC
try
{
var lutCrcRaw = ReadRegister(Register.Genesisflow.LookupFileCrc);
if (lutCrcRaw != null)
{
var lutCrc = RegisterConverter.ConvertTo<UInt32>(lutCrcRaw);
LutCrc = $@"0x{lutCrc:X4}";
}
}
catch (Exception)
{
// ignored
}
//read meter size
MeterSize = MeterSizeConverter.ConvertMeterSizeEnumToSizeName((MeterSize)RegisterConverter.ConvertTo<Byte>(
ReadRegister(Register.Genesisflow.MeterSize)));
//read core revision
var coreRegisterRead = RegisterConverter.ConvertTo<String>(ReadRegister(Register.System.CoreRevision, 16));
CoreRevision = null;
@@ -1353,24 +1395,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
}
//read radio frequency
Region = "NA";
RadioFrequencyMhz = null;
try
{
var radioFrequencyRaw = ReadRegister(Register.Sensusradio.FrequencyIndicator);
if (radioFrequencyRaw != null)
{
Region = "EMEA";
RadioFrequencyMhz = RegisterConverter.ConvertTo<Int32>(radioFrequencyRaw);
}
}
catch (Exception)
{
// ignored
}
//log application information to file
_logger.Info($"PCB ID: {PcbId}");
_logger.Info($"Date time (UTC): {DateTimeOffset.UtcNow}");
@@ -1394,6 +1418,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
_logger.Info($"Meter size: {MeterSize}");
_logger.Info($"Upgrade permission: {MetrologyUpgradePermission:X2}");
//remove unused registers with invalid version
var tempConfigRegisters = _configRegister.MeterRegisterDic.ToList();
@@ -1421,13 +1446,14 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
foreach (var checkMinRegister in Register.GetMinRequiredRegisters())
{
if (!_configRegister.MeterRegisterDic.Any(a => a.Key.GetIdent() == checkMinRegister))
if (_configRegister.MeterRegisterDic.All(a => a.Key.GetIdent() != checkMinRegister))
{
// These registers ar required for essential operation, they have to be added even if the
// version in the configuration.json is outdated or they are not defined!
try
{
var allVersion = tempConfigRegisters.Where(a => a.Key.GetIdent() == checkMinRegister)?.OrderByDescending(s => s.Key.RegisterDetail.Version.Last)?.First();
var allVersion = tempConfigRegisters.Where(a => a.Key.GetIdent() == checkMinRegister)?.OrderByDescending(
s => s.Key.RegisterDetail.Version.Last)?.First();
if (allVersion.HasValue)
{
allVersion.Value.Key.RegisterDetail.Version.Last = int.MaxValue;
@@ -1439,12 +1465,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
_logger.Warn(ex, $"Not able to set minimum list of registers. check json file for {checkMinRegister} ");
}
}
}
if (IsDevelopmentUsage)
{
var registerToPotentialAdd = new List<RegisterDefinition>();
@@ -1457,21 +1480,17 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
if (registerToPotentialAdd.Any())
{
var registerAddForOldConfigs = registerToPotentialAdd.GroupBy(item => item.GetIdent())
.Select(grp => grp.Aggregate((max, cur) =>
(max == null || cur.RegisterDetail.Version.Last > max.RegisterDetail.Version.Last) ? cur : max));
(max == null || cur.RegisterDetail.Version.Last > max.RegisterDetail.Version.Last) ?
cur : max));
foreach (var registerAddOldConfig in registerAddForOldConfigs)
{
registerAddOldConfig.IsAvailable = false;
_configRegister.MeterRegisterDic.TryAdd(registerAddOldConfig, null);
}
//
}
}
}
@@ -1729,15 +1748,15 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
_logger.Info($"Slot:{Slot} - Old PCB identification was {PcbId}");
var pcbIdRaw = ReadRegister(Register.Configexchange.PcbSerialNumber, expectedLength);
if (pcbIdRaw != null)
{
PcbId = Encoding.ASCII.GetString(pcbIdRaw).Split('\0')[0];
_logger.Info($"Slot:{Slot} - Get PCB identification {PcbId}");
return PcbId;
}
var pcbIdRaw = ReadRegister(Register.Configexchange.PcbSerialNumber, expectedLength);
if (pcbIdRaw != null)
{
PcbId = Encoding.ASCII.GetString(pcbIdRaw).Split('\0')[0];
_logger.Info($"Slot:{Slot} - Get PCB identification {PcbId}");
return PcbId;
}
return string.Empty;
return string.Empty;
}
/// <summary>
@@ -1816,9 +1835,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
{
var regDef = _configRegister.GetRegisterDefinitionByName(reg);
var data = RegisterConverter.ConvertFrom(value);
_logger.Info( $"Slot:{Slot} - Write register({regDef.RegisterName}), " +
_logger.Info($"Slot:{Slot} - Write register({regDef.RegisterName}), " +
$"record({BitConverter.ToString(data.ToArray())})");
PreRegisterWrite(regDef, data);
var command = data.Length > RegisterDefinition.ChunkSize ?
@@ -1897,7 +1916,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
if (IsLoggedOn)
{
_logger.Debug($"Slot:{Slot} - Authorization is required");
if (!string.IsNullOrEmpty(_password))
{
IsLoggedOn = false;
@@ -1911,7 +1930,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
case RequestAcknowledgeState.Ok:
break;
//try out this
case RequestAcknowledgeState.CommandError:
case RequestAcknowledgeState.MeterError:
@@ -1927,7 +1946,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// - Initial
/// </remarks>
// ReSharper disable once InconsistentNaming UI1236 is a naming forced by the caller
public Byte[] SendUI1236Command(Byte[] ui1236Frame,Boolean waitForResult = true,Boolean checkRegister = false,UInt16 skipRetryErrorCode = 4)
public Byte[] SendUI1236Command(Byte[] ui1236Frame, Boolean waitForResult = true, Boolean checkRegister = false, UInt16 skipRetryErrorCode = 4)
{
_logger.Info($"Slot:{Slot} - Sending Ui-1236 frame: {ui1236Frame} ");
var sendFifoUi1236 = RequestProtocol.AddRecordToSendFifoUI1236(ui1236Frame);
@@ -29,16 +29,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
private readonly GenesisMeter _currentGenesis;
private Int32 _filePointer;
//TODO THW test only private const String StrNewFileReadWriteMode = "wb+";
//wb open file for writing in binary mode, if file exists its contents will be overwritten,
//if file does not exist it will be created
//private const String StrNewFileReadWriteMode = "wb";
private const String StrNewFileReadWriteMode = "w";
//Open for reading in binary mode. If the file does not exist, FOpen returns NULL
//private const String StrOpenFileReadOnlyMode = "rb";
private const String StrOpenFileReadOnlyMode = "r";
//Open for both reading and writing in binary mode. If the file does not exist, FOpen returns NULL
//private const String StrOpenFileReadWriteMode = "rb+";
private const String StrNewFileReadWriteMode = "w";
private const String StrOpenFileReadOnlyMode = "r";
private const String StrOpenFileReadWriteMode = "r+";
/// <summary>
@@ -176,6 +176,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
/// </summary>
public Boolean StoreConfigEnable = true;
/// <summary>
/// Allow update of genesis flow application
/// </summary>
public Boolean UpdateGenesisFlowEnable;
/// <summary>
/// Enable partial file writes from first failed part to the end
/// </summary>
@@ -245,6 +250,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
/// Ctor
/// </summary>
/// <param name="genesisMeter"></param>
/// <param name="updateGenesisFlowEnable">enable update of genesis flow app</param>
/// <remarks date="2019-Jun-20" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
@@ -254,13 +260,14 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
/// <remarks date="2020-Dec-19" author="Thomas Wiedebusch">
/// - Check installed application before require access to registers.
/// </remarks>
public MeterFwUpdate(GenesisMeter genesisMeter)
public MeterFwUpdate(GenesisMeter genesisMeter, Boolean updateGenesisFlowEnable = false)
{
if (genesisMeter == null)
{
return;
}
UpdateGenesisFlowEnable = updateGenesisFlowEnable;
AssignGenesis(genesisMeter);
if (genesisMeter.MeterAppListVersion.Any(f => f.AppName == "GENESISFLOW" && f.IsInstalled))
@@ -981,6 +988,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
/// <remarks date="2022-Jun-23" author="Thomas Wiedebusch">
/// - Try catch block to avoid e.g. METROLOGYASST_PulseMode.
/// </remarks>
/// <remarks date="2023-Jan-20" author="Thomas Wiedebusch">
/// - Set upgrade permission for metrology to 0xFF if required (will be done by GTB).
/// </remarks>
public Boolean UpdatePreparation()
{
_actualOperation = Resources.StrFwUpdateStatePrepareUpdate;
@@ -1019,6 +1029,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
_registersAfterUpdate = new Dictionary<String, Byte[]>();
try
{
if (UpdateGenesisFlowEnable)
{
_genesisMeter.WriteRegister(Register.System.MetrologyUpgradePermission, new Byte[] { 0xFF });
}
foreach (var item in _registersBeforeUpdate)
{
var writeBackValue = _genesisMeter.ReadRegister(item.Key);
@@ -1031,6 +1045,8 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
{
//nothing to handle
}
_genesisMeter.MetrologyUpgradePermission = RegisterConverter.ConvertTo<Byte>(
_genesisMeter.ReadRegister(Register.System.MetrologyUpgradePermission));
//remove the update stop action
StopUpdateProcess = false;
@@ -1829,15 +1845,20 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
/// <remarks date="2019-Dec-03/05" author="Thomas Wiedebusch">
/// - Extended timeout.
/// </remarks>
/// <remarks date="2023-Jan-18" author="Thomas Wiedebusch">
/// - Set retry counter to 0,
/// - reduce timeout from 5000 to 2000 ms.
/// </remarks>
private Boolean TriggerUpgrade()
{
Boolean returnValue;
//trigger upgrade
_actualOperation = Resources.StrFwUpdateStateTriggerUpgrade;
_updateProcedureRetryCtr = 0;
var triggerCtr = 0;
//set extended timeout for trigger upgrade response delay
_genesisMeter.TransmitProtocol.SetResponseTimeout(5000);
_genesisMeter.TransmitProtocol.SetResponseTimeout(2000);
do
{
returnValue = _genesisMeter.WriteRegister<Byte>(Register.System.TriggerFwUpgrade, 1);
@@ -434,6 +434,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
/// <remarks date="2022-Mar-04" author="Thomas Wiedebusch">
/// - Introduced lock for repeated execution of state machine
/// </remarks>
/// <remarks date="2023-Jan-16" author="Thomas Wiedebusch">
/// - Started state machine with download of new mettbl.
/// </remarks>
private void LutUpdateStateMachine()
{
if (_lutBackupUpdateState == _lutUpdateState)
@@ -451,7 +454,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
case LutUpdateState.StartInitial:
_updateProcedureRetryCtr = 0;
_lutUpdateState = LutUpdateState.EraseLutFile;
_lutUpdateState = LutUpdateState.DownloadLutFile;
//_lutUpdateState = LutUpdateState.EraseLutFile;
break;
case LutUpdateState.EraseLutFile:
@@ -562,6 +567,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
/// <remarks date="2022-Feb-16" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
/// <remarks date="2023-Jan-19" author="Thomas Wiedebusch">
/// - Used genesis meter lut crc, region and meter size read back procedure.
/// </remarks>
private Boolean FinalizeLutDownload()
{
var returnValue = true;
@@ -616,12 +624,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
continue;
}
_operationCtr++;
_actualOperation = "Read back LUT CRC from meter";
var lutCrc = RegisterConverter.ConvertTo<UInt32>(
_genesisMeter.ReadRegister(Register.Genesisflow.LookupFileCrc));
// read back all values
_genesisMeter.CheckRegionSizeLutCrc();
if ((lutCrc & LutCrcErrorMask) != 0)
var lutFileCrc = $"0x{LutFile.FileCrc:X4}";
if (!_genesisMeter.LutCrc.Equals(lutFileCrc))
{
const String txt = "Meter LUT CRC could not be set!";
ErrorMessage = txt;
@@ -632,14 +639,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
}
OnProcessUpdate?.Invoke(this,
new ProcessExecEventArgs($"Read back and validated LUT CRC 0x{lutCrc:X4}"));
new ProcessExecEventArgs($"Read back and validated LUT CRC {_genesisMeter.LutCrc}"));
_operationCtr++;
_actualOperation = "Read back meter size from meter";
var meterSize = (MeterSize)RegisterConverter.ConvertTo<Byte>(
_genesisMeter.ReadRegister(Register.Genesisflow.MeterSize));
if (meterSize != LutFile.MeterSize)
var lutMeterSize = MeterSizeConverter.ConvertMeterSizeEnumToSizeName(LutFile.MeterSize);
if (!_genesisMeter.MeterSize.Equals(lutMeterSize))
{
const String txt = "Meter size could not be set!";
ErrorMessage = txt;
@@ -651,8 +654,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
ErrorMessage = "";
OnProcessUpdate?.Invoke(this,
new ProcessExecEventArgs("Read back and validated meter size " +
$"{MeterSizeConverter.ConvertMeterSizeEnumToSizeName(meterSize)}"));
new ProcessExecEventArgs($"Read back and validated meter size {lutMeterSize}"));
} while (!returnValue && retryCtr++ < RegisterWriteRetries && !StopUpdateProcess);
@@ -802,6 +804,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
/// <remarks date="2022-Feb-16" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
/// <remarks date="2023-Jan-20" author="Thomas Wiedebusch">
/// - Removed list file drive 1 to speed up process. Files will be read back and binary compared!
/// </remarks>
private Boolean DownloadLutFiles()
{
//counters for actual process information
@@ -845,26 +850,26 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
// read all files on drive 1
_operationCtr++;
if (ListMeterFilesDrive1())
{
foreach (var checkInstalledFile in filesToDownload)
{
if (_meterFilesDrive1.Contains(checkInstalledFile))
{
ErrorMessage = "";
var txt = $"{checkInstalledFile} found in meter";
OnProcessUpdate?.Invoke(this, new ProcessExecEventArgs(txt));
continue;
}
//if (ListMeterFilesDrive1())
//{
// foreach (var checkInstalledFile in filesToDownload)
// {
// if (_meterFilesDrive1.Contains(checkInstalledFile))
// {
// ErrorMessage = "";
// var txt = $"{checkInstalledFile} found in meter";
// OnProcessUpdate?.Invoke(this, new ProcessExecEventArgs(txt));
// continue;
// }
ErrorMessage = $"LUT file {StrLutMeterFileName} not installed!\n";
returnValue = false;
}
}
else
{
returnValue = false;
}
// ErrorMessage = $"LUT file {StrLutMeterFileName} not installed!\n";
// returnValue = false;
// }
//}
//else
//{
// returnValue = false;
//}
if (!returnValue)
{
@@ -1 +1 @@
5ed75d99ee45ff67821090f1b3dbb001dd9e4fe3
1a3d4919c9c702245832d925951f2b7cb72fc333
+3 -8
View File
@@ -1,5 +1,5 @@
using System.Windows;
using System.Windows.Input;
using System;
using System.Windows;
namespace ProductionUiCordonel
{
@@ -8,12 +8,7 @@ namespace ProductionUiCordonel
/// </summary>
public partial class App : Application
{
public App()
{
//this.StartupUri = new Uri("MainWindow.xaml");
//this.StartupUri = new Uri("MultiMode.xaml");
}
private void Application_Startup(object sender, StartupEventArgs e)
private void Application_Startup(Object sender, StartupEventArgs e)
{
if (true)
@@ -1,7 +1,7 @@
using Newtonsoft.Json;
using System;
using System;
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;
namespace ProductionUiCordonel
{
@@ -14,40 +14,40 @@ namespace ProductionUiCordonel
public class Pos
{
public double Left { get; set; }
public double Top { get; set; }
public double Height { get; set; }
public double Width { get; set; }
public Double Left { get; set; }
public Double Top { get; set; }
public Double Height { get; set; }
public Double Width { get; set; }
}
public class MultiFormChilds
{
public Type ViewModelType { get; set; }
public bool Visisble { get; set; }
public string Name { get; set; }
public int Slot { get; set; }
public string TextPort { get; set; }
public Boolean Visisble { get; set; }
public String Name { get; set; }
public Int32 Slot { get; set; }
public String TextPort { get; set; }
public Pos StartPos { get; set; }
}
public int Slot { get; set; }
public Int32 Slot { get; set; }
public int? PressureStationId { get; set; }
public bool AutoDetect { get; set; }
public Int32? PressureStationId { get; set; }
public Boolean AutoDetect { get; set; }
public bool AccessToPresuretestTab { get; set; }
public bool AccessToMarrieTab { get; set; }
public bool AccessToFinalcheckTab { get; set; }
public Boolean AccessToPresuretestTab { get; set; }
public Boolean AccessToMarrieTab { get; set; }
public Boolean AccessToFinalcheckTab { get; set; }
public bool AccessToSettingTab { get; set; }
public bool AccessToStatusTab { get; set; }
public bool AccessToPickingTab { get; set; }
public Boolean AccessToSettingTab { get; set; }
public Boolean AccessToStatusTab { get; set; }
public Boolean AccessToPickingTab { get; set; }
public int? SirtComport433 { get; set; }
public int? SirtComport866 { get; set; }
public int? SirtBoxNr { get; set; }
public Int32? SirtComport433 { get; set; }
public Int32? SirtComport866 { get; set; }
public Int32? SirtBoxNr { get; set; }
public int? StationId { get; set; }
public Int32? StationId { get; set; }
public List<MultiFormChilds> ChildForms { get; set; }
@@ -0,0 +1,101 @@
namespace ProductionUiCordonel.Data
{
/// <summary>
/// Genesis meter final test states
/// </summary>
public enum FinalTestState
{
/// <summary>
/// Idle (nothing to do)
/// </summary>
Idle,
/// <summary>
/// Start the initial execution
/// </summary>
StartInitial,
/// <summary>
/// Error handling
/// </summary>
Error,
/// <summary>
/// Single processing step failed
/// </summary>
StepFailed,
/// <summary>
/// Repeat last step
/// </summary>
RepeatStep,
/// <summary>
/// Repeat the entire final test
/// </summary>
RepeatFinalTest,
/// <summary>
/// Final test failed
/// </summary>
FinalTestFailed,
/// <summary>
/// Check the actual shipping state
/// </summary>
CheckShippingState,
/// <summary>
/// Check the attachments
/// </summary>
CheckAttachments,
/// <summary>
/// Check the order number
/// </summary>
CheckOrderNumber,
/// <summary>
/// Check the serial number
/// </summary>
CheckSerialNumber,
/// <summary>
/// Connect to Cordonel
/// </summary>
ConnectCordonel,
/// <summary>
/// Store all configurations to FLASH memory
/// </summary>
StoreAllConfigurations,
/// <summary>
/// Reboot the Cordonel to check all parameters being stored to FLASH memory
/// </summary>
RebootCordonel,
/// <summary>
/// Finalize process
/// </summary>
FinalizeProcess,
/// <summary>
/// Final parametrization fixed values
/// </summary>
FinalParametrizationFix,
/// <summary>
/// Final parametrization with VAKO and CSD
/// </summary>
FinalParametrizationVakoCsd,
/// <summary>
/// Read out all parametrization values
/// </summary>
FullReadOutParametrization,
/// <summary>
/// Check all settings for against required values
/// </summary>
ConfigurationCheck,
/// <summary>
/// Acquire, process set the password file
/// </summary>
ProcessPasswordFile,
/// <summary>
/// Process special configuration
/// </summary>
ProcessSpecialConfig,
/// <summary>
/// Prepare shipping mode
/// </summary>
PrepareShippingMode,
/// <summary>
/// Delimiter for list
/// </summary>
StateListDelimiter
}
}
@@ -0,0 +1,52 @@
using System;
using System.Linq;
using ProductionUiCordonel.Properties;
namespace ProductionUiCordonel.Data
{
/// <summary>
/// Concatenation of state and string
/// </summary>
public static class FinalTestStateInfo
{
/// <summary>
/// Build state information
/// </summary>
private static readonly FinalTestStateText[] StateInfos;
/// <summary>
/// Ctor
/// </summary>
static FinalTestStateInfo()
{
StateInfos = new FinalTestStateText[(Int32)FinalTestState.StateListDelimiter];
StateInfos[(Int32)FinalTestState.Idle].State = FinalTestState.Idle;
StateInfos[(Int32)FinalTestState.Idle].Message = Resources.StrStateIdle;
StateInfos[(Int32)FinalTestState.StartInitial].State = FinalTestState.StartInitial;
StateInfos[(Int32)FinalTestState.StartInitial].Message = Resources.StrStateStartInitial;
}
/// <summary>
/// Get the current information
/// </summary>
/// <param name="state">state to search for information text</param>
public static String GetTextFromState(FinalTestState state)
{
return (from stateInfo in StateInfos
where stateInfo.State == state
select stateInfo.Message).FirstOrDefault();
}
/// <summary>
/// Get the state of the text
/// </summary>
/// <param name="text">information text to search if state is assigned</param>
public static FinalTestState GetStateFromText(String text)
{
return (from stateInfo in StateInfos
where stateInfo.Message == text
select stateInfo.State).FirstOrDefault();
}
}
}
@@ -0,0 +1,19 @@
using System;
namespace ProductionUiCordonel.Data
{
/// <summary>
/// Concatenation between final test state and text
/// </summary>
public struct FinalTestStateText
{
/// <summary>
/// The state of the final test
/// </summary>
public FinalTestState State;
/// <summary>
/// The message text of the final test state
/// </summary>
public String Message;
}
}
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
@@ -10,41 +7,41 @@ namespace ProductionUiCordonel.Data
{
public class PickingItemCheckReturn
{
public bool? Result;
public string Msg;
public Boolean? Result;
public String Msg;
}
public abstract class PickingResultBaseData : IPickingResultData
{
public string Ident { get; set; }
public String Ident { get; set; }
public int Index { get; set; }
public Int32 Index { get; set; }
public string CheckText { get; set; }
public String CheckText { get; set; }
public string CurrentValueText { get; set; }
public String CurrentValueText { get; set; }
public bool? Result { get; set; }
public Boolean? Result { get; set; }
public bool HasError { get; set; }
public Boolean HasError { get; set; }
public System.Windows.Media.Brush ResultColor { get { return getColorFromResult(); } }
public abstract Func<PickingItemCheckReturn> Action { get; }
public Brush ResultColor => getColorFromResult();
public abstract Func<PickingItemCheckReturn> Action { get; }
private System.Windows.Media.Brush getColorFromResult()
private Brush getColorFromResult()
{
var converter = new System.Windows.Media.BrushConverter();
var brush = (System.Windows.Media.Brush)converter.ConvertFromString("#000000");
var converter = new BrushConverter();
var brush = (Brush)converter.ConvertFromString("#000000");
if (Result.HasValue) // && a.Result.Value ))
{
if (!Result.Value)
{
brush = (System.Windows.Media.Brush)converter.ConvertFromString("#FF8000");
brush = (Brush)converter.ConvertFromString("#FF8000");
}
else
{
brush = (System.Windows.Media.Brush)converter.ConvertFromString("#419C14");
brush = (Brush)converter.ConvertFromString("#419C14");
}
}
@@ -54,34 +51,34 @@ public abstract class PickingResultBaseData : IPickingResultData
}
public interface IPickingResultData
{
string Ident { get; set; }
String Ident { get; set; }
int Index { get; set; }
string CheckText { get; set; }
Int32 Index { get; set; }
String CheckText { get; set; }
string CurrentValueText { get; set; }
String CurrentValueText { get; set; }
bool? Result { get; set; }
Boolean? Result { get; set; }
bool HasError { get; set; }
Boolean HasError { get; set; }
System.Windows.Media.Brush ResultColor { get; }
Brush ResultColor { get; }
Func<PickingItemCheckReturn> Action { get; }
}
public class PickingResultRegisterData : PickingResultBaseData
{
public string RegisterIdent { get; set; }
public String RegisterIdent { get; set; }
public GenesisMeter ReadMeter { get; set; }
public object CompareObject { get; set; }
public Object CompareObject { get; set; }
public override Func<PickingItemCheckReturn> Action { get { return staticReadAndCompareAction(); } }
public override Func<PickingItemCheckReturn> Action => staticReadAndCompareAction();
public Func<PickingItemCheckReturn> staticReadAndCompareAction()
{
return delegate ()
return delegate
{
var retComp = new PickingItemCheckReturn();
retComp.Result = null;
@@ -97,7 +94,7 @@ public abstract class PickingResultBaseData : IPickingResultData
}
else if (CompareObject is Boolean boolCompare)
{
retComp.Result = boolCompare.Equals(RegisterConverter.ConvertTo<bool>(r));
retComp.Result = boolCompare.Equals(RegisterConverter.ConvertTo<Boolean>(r));
retComp.Msg = boolCompare.ToString();
}
@@ -117,8 +114,7 @@ public abstract class PickingResultBaseData : IPickingResultData
}
public readonly Func<PickingItemCheckReturn> _action;
public override Func<PickingItemCheckReturn> Action { get { return _action; } }
public override Func<PickingItemCheckReturn> Action => _action;
}
}
@@ -39,24 +39,24 @@ namespace ProductionUiCordonel.Data
}
public string PcbId;
public String PcbId;
private int rev = 0;
private Int32 rev;
public int Rev
public Int32 Rev
{
get { return rev; }
get => rev;
set
{
rev = value;
InternalPropertyChanged(nameof(Rev));
}
}
private bool? passed = false;
public bool? Passed
private Boolean? passed = false;
public Boolean? Passed
{
get { return passed; }
get => passed;
set
{
passed = value;
@@ -66,10 +66,10 @@ namespace ProductionUiCordonel.Data
private string testerName = "C. Röhl";
private String testerName = "C. Röhl";
public String TesterName
{
get { return testerName; }
get => testerName;
set
{
testerName = value;
@@ -77,10 +77,10 @@ namespace ProductionUiCordonel.Data
}
}
private string testPressure = "6";
private String testPressure = "6";
public String TestPressure
{
get { return testPressure; }
get => testPressure;
set
{
testPressure = value;
@@ -89,10 +89,10 @@ namespace ProductionUiCordonel.Data
}
private string leakRate = " 0,00001";
private String leakRate = " 0,00001";
public String LeakRate
{
get { return leakRate; }
get => leakRate;
set
{
leakRate = value;
@@ -100,10 +100,10 @@ namespace ProductionUiCordonel.Data
}
}
private string remark = "";
private String remark = "";
public String Remark
{
get { return remark; }
get => remark;
set
{
remark = value;
@@ -112,21 +112,22 @@ namespace ProductionUiCordonel.Data
}
private ObservableCollection<PressureTestPoints> testpoints = new ObservableCollection<PressureTestPoints>() {
new PressureTestPoints() { Ident = 1, Input = "2E-07" },
new PressureTestPoints() { Ident = 2, Input = "2E-07" },
new PressureTestPoints() { Ident = 3, Input = "2E-07" },
new PressureTestPoints() { Ident = 4, Input = "2E-07" },
new PressureTestPoints() { Ident = 5, Input = "2E-07" },
new PressureTestPoints() { Ident = 6, Input = "2E-07" },
new PressureTestPoints() { Ident = 7, Input = "2E-07" },
new PressureTestPoints() { Ident = 8, Input = "2E-07" },
new PressureTestPoints() { Ident = 9, Input = "2E-07" },
new PressureTestPoints() { Ident = 10, Input = "2E-07" }
private ObservableCollection<PressureTestPoints> testpoints = new ObservableCollection<PressureTestPoints>
{
new PressureTestPoints { Ident = 1, Input = "2E-07" },
new PressureTestPoints { Ident = 2, Input = "2E-07" },
new PressureTestPoints { Ident = 3, Input = "2E-07" },
new PressureTestPoints { Ident = 4, Input = "2E-07" },
new PressureTestPoints { Ident = 5, Input = "2E-07" },
new PressureTestPoints { Ident = 6, Input = "2E-07" },
new PressureTestPoints { Ident = 7, Input = "2E-07" },
new PressureTestPoints { Ident = 8, Input = "2E-07" },
new PressureTestPoints { Ident = 9, Input = "2E-07" },
new PressureTestPoints { Ident = 10, Input = "2E-07" }
};
public ObservableCollection<PressureTestPoints> Testpoints
{
get { return testpoints; }
get => testpoints;
set
{
testpoints = value;
@@ -134,7 +135,7 @@ namespace ProductionUiCordonel.Data
}
}
internal void SetAllTestPoints(string input)
internal void SetAllTestPoints(String input)
{
foreach (var item in Testpoints)
{
@@ -1,15 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProductionUiCordonel.Event
{
public class StringArgs : EventArgs
{
public readonly string Content;
public StringArgs(string content)
public readonly String Content;
public StringArgs(String content)
{
Content = content;
}
+2 -2
View File
@@ -14,7 +14,7 @@
<ComboBox Name="cbxSlotBox" Margin="0,5,0,0" VerticalAlignment="Top" SelectionChanged="CbxSlotBox_SelectionChanged" />
<Button Name="BtnConntect" VerticalAlignment="Top" Click="BtnConntect_Click" HorizontalAlignment="Right" ToolTip="Force connect to meter">
<Button Name="BtnConnect" VerticalAlignment="Top" Click="BtnConntect_Click" HorizontalAlignment="Right" ToolTip="Force connect to meter">
<StackPanel Orientation="Horizontal">
<Image Source="/Resources/Connect_16x.png" />
<TextBlock Margin="3,0,0,0">Connect</TextBlock>
@@ -89,7 +89,7 @@
</Grid.ColumnDefinitions>
<!--<Button Name="btnStart" IsEnabled="False" Content="Start" Click="ButtonBase_OnClick" HorizontalAlignment="Left" Height="58" Margin="0,0,0,1" VerticalAlignment="Bottom" Width="122" Grid.Row="0" Grid.Column="4" Grid.RowSpan="2" />-->
<Label Content="SerialNumber" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="0" Grid.Column="0" Height="26" Width="82" />
<Label Content="RadioAdress" HorizontalAlignment="Left" Margin="10,2,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="0" Height="26" Width="76" />
<Label Content="RadioAddress" HorizontalAlignment="Left" Margin="10,2,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="0" Height="26" Width="76" />
<Label Content="OrderNumber" HorizontalAlignment="Left" Margin="10,3,0,0" VerticalAlignment="Top" Grid.Row="2" Grid.Column="0" Height="26" Width="84" />
+106 -140
View File
@@ -1,11 +1,8 @@
using Newtonsoft.Json;
using ProductionUiCordonel.ProductionProcesses;
using ProductionUiCordonel.ProductionProcesses.Actions;
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
@@ -14,7 +11,13 @@ using System.Threading.Tasks;
using System.Timers;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Threading;
using Newtonsoft.Json;
using ProductionUiCordonel.ProductionProcesses;
using ProductionUiCordonel.ProductionProcesses.Actions;
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.CommonCore.Consts;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig;
@@ -27,18 +30,18 @@ namespace ProductionUiCordonel
/// <summary>
/// Interaction logic for FinalRadioTest.xaml
/// </summary>
public partial class FinalRadioTest : Window
public partial class FinalRadioTest
{
public event EventHandler OnLockMeter;
public event EventHandler OnReleaseMeter;
public event EventHandler OrderHasChanged;
public event EventHandler KeyInputMainFrom;
//public event EventHandler KeyInputMainFrom;
#region prop
private GenesisMeter genesisMeter;
public GenesisMeter CurrentGenesisMeter
{
get { return genesisMeter; }
get => genesisMeter;
set
{
var oldMeter = genesisMeter;
@@ -47,14 +50,11 @@ namespace ProductionUiCordonel
}
}
private int orderNumber = 0;
public int OrderNumber
private Int32 orderNumber;
public Int32 OrderNumber
{
////lblOrderNumber
get
{
return orderNumber;
}
get => orderNumber;
set
{
orderNumber = value;
@@ -66,37 +66,31 @@ namespace ProductionUiCordonel
}
}
private long radioAdress = 0;
public long RadioAdress
private Int64 radioAddress;
public Int64 RadioAddress
{
get
{
return radioAdress;
}
get => radioAddress;
set
{
radioAdress = value;
radioAddress = value;
updateContentControl(lblRadioAdress, "-");
if (radioAdress != 0)
if (radioAddress != 0)
{
updateContentControl(lblRadioAdress, radioAdress.ToString());
updateContentControl(lblRadioAdress, radioAddress.ToString());
}
}
}
private string serialNumber = "-";
public string SerialNumber
private String serialNumber = "-";
public String SerialNumber
{
get
{
return serialNumber;
}
get => serialNumber;
set
{
serialNumber = value;
updateContentControl(lblSerialNumber, "-");
if (!String.IsNullOrEmpty(serialNumber))
if (!string.IsNullOrEmpty(serialNumber))
{
updateContentControl(lblSerialNumber, serialNumber);
}
@@ -104,19 +98,16 @@ namespace ProductionUiCordonel
}
}
private string lastPcbID;
private string currentProcess = "-";
public string CurrentProcess
private String lastPcbID;
private String currentProcess = "-";
public String CurrentProcess
{
get
{
return currentProcess;
}
get => currentProcess;
set
{
currentProcess = value;
updateContentControl(lblCurrentProcess, "-");
if (!String.IsNullOrEmpty(currentProcess))
if (!string.IsNullOrEmpty(currentProcess))
{
updateContentControl(lblCurrentProcess, currentProcess);
}
@@ -139,14 +130,14 @@ namespace ProductionUiCordonel
}
public EventHandler OnPcbIdDetect;
private int intervalWithoutDetect = 1000;
private int intervalWithDetect = 10000;
private string _currentPcbID;
private Int32 intervalWithoutDetect = 1000;
private Int32 intervalWithDetect = 10000;
private String _currentPcbID;
private Timer tmrAutoDetect;
public ApplicationSettings Settings { get; set; }
private void Window_Initialized(object sender, EventArgs e)
private void Window_Initialized(Object sender, EventArgs e)
{
var configfile = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), nameof(Xylem.Common.Hardware.WaterMeter.Genesis), ProgramConfig.SerialConfigFileName);
var configfile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), nameof(Xylem.Common.Hardware.WaterMeter.Genesis), ProgramConfig.SerialConfigFileName);
if (!File.Exists(configfile))
{
@@ -172,11 +163,11 @@ namespace ProductionUiCordonel
useSetting(true);
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
private void Window_Closing(Object sender, CancelEventArgs e)
{
DisposeAllConnections();
}
private void useSetting(bool setSlot = false)
private void useSetting(Boolean setSlot = false)
{
tmrAutoDetect.Enabled = Settings.AutoDetect;
tblkAutodetectState.Text = "Off";
@@ -207,38 +198,35 @@ namespace ProductionUiCordonel
}
private MeterBatch CurrentBatch;
private bool detectIsLocked;
private Boolean detectIsLocked;
private string _lastMsg;
public string LastMsg
private String _lastMsg;
public String LastMsg
{
set
{
_lastMsg = value;
updateUi(lblMessage, _lastMsg);
}
get
{
return _lastMsg;
}
get => _lastMsg;
}
private void updateUi(ContentControl c, string content)
private void updateUi(ContentControl c, String content)
{
c.Dispatcher.Invoke(DispatcherPriority.Normal,
new Action(() => { c.Content = content; }));
}
private void updateUi(TextBox c, string content)
private void updateUi(TextBox c, String content)
{
c.Dispatcher.Invoke(DispatcherPriority.Normal,
new Action(() => { c.Text = content; }));
}
private void updateUi(TextBlock c, string content)
private void updateUi(TextBlock c, String content)
{
c.Dispatcher.Invoke(DispatcherPriority.Normal,
new Action(() => { c.Text = content; }));
}
public string CurrentPcbID
public String CurrentPcbID
{
set
{
@@ -270,12 +258,9 @@ namespace ProductionUiCordonel
}
}
get
{
return _currentPcbID;
}
get => _currentPcbID;
}
private void GetPcbMapping(string pcbID)
private void GetPcbMapping(String pcbID)
{
if (string.IsNullOrEmpty(pcbID))
{
@@ -288,21 +273,18 @@ namespace ProductionUiCordonel
try
{
var responseJson = LocalWebRequest.GetRequest(url);
var a = JsonConvert.DeserializeObject<string[]>(responseJson);
var a = JsonConvert.DeserializeObject<String[]>(responseJson);
var tmpInt = 0;
int.TryParse(a[1], out tmpInt);
int.TryParse(a[1], out var tmpInt);
OrderNumber = tmpInt;
long tmpLong = 0;
Int64 tmpLong = 0;
if (a.Length > 2)
{
long.TryParse(a[2], out tmpLong);
}
RadioAdress = tmpLong;
RadioAddress = tmpLong;
SerialNumber = a[0];
if (a.Length > 3 && a[3] != SerialNumber)
{
@@ -325,13 +307,13 @@ namespace ProductionUiCordonel
}
});
}
private bool Detect(bool IgnorErrors, int slot)
private Boolean Detect(Boolean IgnorErrors, Int32 slot)
{
if (!detectIsLocked)
{
LastMsg = "Start Detect";
CurrentProcess = "Suche Cordonel";
bool hasDetect = false;
Boolean hasDetect = false;
if (string.IsNullOrEmpty(CurrentPcbID) || CurrentGenesisMeter == null)
{
var mb = new MeterBatch();
@@ -359,7 +341,7 @@ namespace ProductionUiCordonel
else
{
CurrentProcess = "Cordonel nicht gefunden";
LastMsg = $"No Meter found";
LastMsg = "No Meter found";
DisposeAllConnections();
}
@@ -381,7 +363,6 @@ namespace ProductionUiCordonel
if (string.IsNullOrEmpty(ret) || ret != CurrentPcbID)
{
LastMsg = "Meter connection lost";
hasDetect = false;
DisposeAllConnections();
CurrentPcbID = "";
@@ -396,13 +377,11 @@ namespace ProductionUiCordonel
}
return hasDetect;
}
else
{
LastMsg = "Meter is still connected (locked)";
return true;
}
LastMsg = "Meter is still connected (locked)";
return true;
}
private void TmrAutoDetect_Elapsed(object sender, ElapsedEventArgs e)
private void TmrAutoDetect_Elapsed(Object sender, ElapsedEventArgs e)
{
tmrAutoDetect.Enabled = false;
var hasDetect = Detect(true, 1);
@@ -419,7 +398,7 @@ namespace ProductionUiCordonel
private ProductionProcessCheckOrderNumber orderBarcode;
private ProductionProcessCheckSerialNumber serialBarcode;
public void SetUpBlank(bool retry, bool abort = false)
public void SetUpBlank(Boolean retry, Boolean abort = false)
{
pc.Processes = new List<IProductionProcess>();
@@ -427,7 +406,7 @@ namespace ProductionUiCordonel
pc.ProcessLogHandler += PcOnProcessLogHandler;
pc.ProcessProgressHandler += Pc_ProcessProgressHandler;
var connectProcess = new ProductionProcessConnect();
var connectProcess = new ProductionProcessConnect(CurrentGenesisMeter);
pc.Processes.Add(connectProcess); //[x] [x] [x]
@@ -439,7 +418,7 @@ namespace ProductionUiCordonel
pc.Processes.Add(orderBarcode); //[x] [x] [x]
serialBarcode = new ProductionProcessCheckSerialNumber(SerialNumber, RadioAdress.ToString());
serialBarcode = new ProductionProcessCheckSerialNumber(SerialNumber, RadioAddress.ToString());
pc.Processes.Add(serialBarcode); //[x] [x] [x]
//pc.Processes.Add(new ProductionProcessFullReadOut()); //[x] [x] [x]
@@ -448,10 +427,10 @@ namespace ProductionUiCordonel
pc.Processes.Add(new ProductionProcessPasswordFile()); //[x] [x] [x]
//pc.Processes.Add(new ProductionProcessFinalParameterizationFix()); //[x] [x] []
pc.Processes.Add(new ProductionProcessFinalParameterizationVakoCsd(connectProcess, RadioAdress != 0)); //[x] [x] []
//pc.Processes.Add(new ProductionProcessFinalParametrizationFix()); //[x] [x] []
pc.Processes.Add(new ProductionProcessFinalParametrizationVakoCsd(connectProcess, RadioAddress != 0)); //[x] [x] []
//if (RadioAdress != 0)
//if (RadioAddress != 0)
//{
var radioCheck = new ProductionProcessRadioCheck();
@@ -464,11 +443,11 @@ namespace ProductionUiCordonel
//}
//pc.Processes.Add(new ProductionProcessSpecialConfig()); //[x] [x] []
pc.Processes.Add(new ProductionProcessShippingMode(true, RadioAdress != 0)); //[] [] []
pc.Processes.Add(new ProductionProcessShippingMode(true, RadioAddress != 0)); //[] [] []
pc.Processes.Add(new ProductionProcessFinalParameterizationVakoCsd(connectProcess, RadioAdress != 0)); //[x] [x] []
pc.Processes.Add(new ProductionProcessFinalParametrizationVakoCsd(connectProcess, RadioAddress != 0)); //[x] [x] []
pc.Processes.Add(new ProductionProcessShippingMode(false, RadioAdress != 0)); //[] [] []
pc.Processes.Add(new ProductionProcessShippingMode(false, RadioAddress != 0)); //[] [] []
pc.Processes.Add(new ProductionProcessFullReadOut()); //[x] [x] [x]
pc.Processes.Add(new ProductionProcessLogOff()); //[] [] []
@@ -476,7 +455,7 @@ namespace ProductionUiCordonel
var checkAttach = new ProductionProcessCheckAttachment(OrderNumber);
orderBarcode.isDone += (x, g) =>
{
checkAttach.OrderNumber = ((ProductionProcessCheckOrderNumber)x).Ordernumber; ;
checkAttach.OrderNumber = ((ProductionProcessCheckOrderNumber)x).Ordernumber;
};
pc.Processes.Add(checkAttach); //[] [] []
@@ -485,7 +464,7 @@ namespace ProductionUiCordonel
errorP.isDone += allProcessesDone;
pc.ErrorProcess = errorP;
var successeP = new ProductionProcessDone(false);
var successeP = new ProductionProcessDone();
successeP.isDone += allProcessesDone;
pc.DoneProcess = successeP;
@@ -504,7 +483,7 @@ namespace ProductionUiCordonel
}
}
private void CheckOrder_isDone(object sender, EventArgs e)
private void CheckOrder_isDone(Object sender, EventArgs e)
{
OrderNumber = ((ProductionProcessCheckOrderNumber)sender).Ordernumber;
@@ -512,7 +491,7 @@ namespace ProductionUiCordonel
}
private void Radio_CheckOrder_isDone(object sender, EventArgs e)
private void Radio_CheckOrder_isDone(Object sender, EventArgs e)
{
OrderNumber = ((ProductionProcessCheckOrderNumber)sender).Ordernumber;
@@ -520,7 +499,7 @@ namespace ProductionUiCordonel
}
private void allProcessesDone(object sender, Tuple<bool, bool, bool> e)
private void allProcessesDone(Object sender, Tuple<Boolean, Boolean, Boolean> e)
{
detectIsLocked = false;
if (e.Item3)
@@ -539,7 +518,7 @@ namespace ProductionUiCordonel
{
return;
}
if (newMeter == null && oldMeter != null)
if (newMeter == null)
{
//remove all
CurrentProcess = "Warte auf Zähler";
@@ -548,7 +527,7 @@ namespace ProductionUiCordonel
return;
}
if (oldMeter?.PcbId == newMeter?.PcbId && newMeter?.PcbId == lastPcbID)
if (oldMeter?.PcbId == newMeter.PcbId && newMeter.PcbId == lastPcbID)
{
return;
}
@@ -556,16 +535,9 @@ namespace ProductionUiCordonel
UiElmEnable(btnDetect, false);
CurrentProcess = "Bitte den Startknopf drücken";
Task.Run(() => { LoadDetails(); });
//real change
}
private void UiElmEnable(UIElement elm, bool isEnabled)
private void UiElmEnable(UIElement elm, Boolean isEnabled)
{
elm.Dispatcher.Invoke(DispatcherPriority.Normal,
new Action(() =>
@@ -575,14 +547,14 @@ namespace ProductionUiCordonel
}
));
}
private void PcOnProcessLogHandler(object sender, PopUpProcessLogArgs e)
private void PcOnProcessLogHandler(Object sender, PopUpProcessLogArgs e)
{
txtLog.Dispatcher.Invoke(DispatcherPriority.Normal,
new Action(() =>
{
if (e != null)
{
txtLog.Text = e.Data + System.Environment.NewLine + txtLog.Text;
txtLog.Text = e.Data + Environment.NewLine + txtLog.Text;
}
}
));
@@ -595,10 +567,7 @@ namespace ProductionUiCordonel
pbTotalProgress.Dispatcher.Invoke(DispatcherPriority.Normal,
new Action(() =>
{
if (e != null)
{
pbTotalProgress.Value = e.Progress;
}
pbTotalProgress.Value = e.Progress;
}
));
}
@@ -607,27 +576,25 @@ namespace ProductionUiCordonel
pbSubProgress.Dispatcher.Invoke(DispatcherPriority.Normal,
new Action(() =>
{
if (e != null)
{
pbSubProgress.Value = e.Progress;
}
pbSubProgress.Value = e.Progress;
}
));
}
}
private void updateContentControl(ContentControl ctl, string text)
private void updateContentControl(ContentControl ctl, String text)
{
ctl.Dispatcher.Invoke(DispatcherPriority.Normal,
new Action(() =>
{
if (ctl != null) // table is a DataTable
if (true) // table is a DataTable
{
ctl.Content = text;
}
}
));
}
private void updateStatusGrid()
{
var dt = new DataTable();
@@ -645,14 +612,12 @@ namespace ProductionUiCordonel
dgTotalProcess.Dispatcher.Invoke(DispatcherPriority.Normal,
new Action(() =>
{
if (dt != null) // table is a DataTable
if (true) // table is a DataTable
{
dgTotalProcess.DataContext = dt;
}
}
));
}
@@ -663,19 +628,17 @@ namespace ProductionUiCordonel
{
dpSubProcess.Children.Clear();
dpSubProcess.Children.Add(c);
DockPanel.SetDock(c, Dock.Top & Dock.Left);
DockPanel.SetDock(c, Dock.Top); // & Dock.Left);
}
));
}
private void Pc_ProcessStateChangedHandler(object sender, EventArgs e)
private void Pc_ProcessStateChangedHandler(Object sender, EventArgs e)
{
if (sender is IProductionProcess)
{
var currentProcess = ((IProductionProcess)sender);
updateProcessControl(currentProcess.GetUserControl());
var process = ((IProductionProcess)sender);
updateProcessControl(process.GetUserControl());
}
updateStatusGrid();
@@ -696,7 +659,7 @@ namespace ProductionUiCordonel
currentProcess = "Warte auf Zähler";
OrderNumber = 0;
SerialNumber = "-";
RadioAdress = 0;
RadioAddress = 0;
return;
}
lastPcbID = CurrentGenesisMeter.PcbId;
@@ -705,14 +668,14 @@ namespace ProductionUiCordonel
}
private void BtnSwitchAutoDetect_Click(object sender, RoutedEventArgs e)
private void BtnSwitchAutoDetect_Click(Object sender, RoutedEventArgs e)
{
Settings.AutoDetect = !Settings.AutoDetect;
storeSetting();
useSetting();
}
private void CbxSlotBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
private void CbxSlotBox_SelectionChanged(Object sender, SelectionChangedEventArgs e)
{
}
@@ -721,11 +684,11 @@ namespace ProductionUiCordonel
Settings.Update("ProductionUiConfig.json");
}
private void BtnConntect_Click(object sender, RoutedEventArgs e)
private void BtnConntect_Click(Object sender, RoutedEventArgs e)
{
var hasDetect = Detect(false, (int)cbxSlotBox.SelectedValue);
Detect(false, (Int32)cbxSlotBox.SelectedValue);
Settings.Slot = (int)cbxSlotBox.SelectedValue;
Settings.Slot = (Int32)cbxSlotBox.SelectedValue;
storeSetting();
}
private void runDetect()
@@ -742,7 +705,7 @@ namespace ProductionUiCordonel
pc.Start(CurrentGenesisMeter);
}
}
private void BtnDetect_Click(object sender, RoutedEventArgs e)
private void BtnDetect_Click(Object sender, RoutedEventArgs e)
{
runDetect();
}
@@ -751,36 +714,39 @@ namespace ProductionUiCordonel
var sb = new StringBuilder();
var fileName = $"{DateTime.Now.ToString("yyyyMMddHHmmss")}_ReturnNoteTxt_{lblPcbID.Content}.txt";
sb.AppendLine($"Aufallschein {DateTime.Now}");
sb.AppendLine($"----------------------------------");
sb.AppendLine("----------------------------------");
sb.AppendLine($"PcbId {lblPcbID.Content}");
sb.AppendLine($"Auftrag {lblOrderNumber.Content}");
sb.AppendLine($"Seriennummer {lblSerialNumber.Content}");
sb.AppendLine($"Status {lblMessage.Text}");
sb.AppendLine($"-------------Meldung---------------");
sb.AppendLine("-------------Meldung---------------");
sb.Append($"{txtLog.Text}");
File.WriteAllText(fileName, sb.ToString());
//txtLog.Text
System.Diagnostics.Process.Start(fileName);
Process.Start(fileName);
}
private void Window_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
private void Window_PreviewKeyDown(Object sender, KeyEventArgs e)
{
txtInputHidden.Focus();
if (e.Key == System.Windows.Input.Key.Enter)
if (e.Key == Key.Enter)
{
if (serialBarcode?.GetUserControl() is UcBarcodeInput bar)
{
bar?.inputKey(txtInputHidden.Text);
bar.inputKey(txtInputHidden.Text);
}
if (orderBarcode?.GetUserControl() is UcBarcodeInput obar)
if (orderBarcode?.GetUserControl() is UcBarcodeInput orderBar)
{
obar?.inputKey(txtInputHidden.Text);
orderBar.inputKey(txtInputHidden.Text);
}
txtInputHidden.Clear();
}
}
protected virtual void OnOnReleaseMeter()
{
OnReleaseMeter?.Invoke(this, EventArgs.Empty);
}
}
}
+1 -1
View File
@@ -15,7 +15,7 @@
<ComboBox Name="cbxSlotBox" Margin="0,5,0,0" VerticalAlignment="Top" SelectionChanged="CbxSlotBox_SelectionChanged" />
<Button Name="BtnConntect" VerticalAlignment="Top" Click="BtnConntect_Click" HorizontalAlignment="Right" ToolTip="Force connect to meter">
<Button Name="BtnConntect" VerticalAlignment="Top" Click="BtnConnect_Click" HorizontalAlignment="Right" ToolTip="Force connect to meter">
<StackPanel Orientation="Horizontal">
<Image Source="/Resources/Connect_16x.png" />
<TextBlock Margin="3,0,0,0">Connect</TextBlock>
+45 -59
View File
@@ -1,24 +1,20 @@
using Newtonsoft.Json;
using ProductionUiCordonel.Model;
using System;
using System.Data;
using System.Globalization;
using System;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Timers;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Threading;
using Newtonsoft.Json;
using ProductionUiCordonel.Model;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.CommonCore.Consts;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
using Xylem.Common.Logic.SoftwareAccessHelper;
namespace ProductionUiCordonel
@@ -62,14 +58,14 @@ namespace ProductionUiCordonel
public EventHandler OnPcbIdDetect;
private int intervalWithoutDetect = 1000;
private int intervalWithDetect = 10000;
private string _currentPcbID;
private Int32 intervalWithoutDetect = 1000;
private Int32 intervalWithDetect = 10000;
private String _currentPcbID;
public PickingViewModel PickingData = new PickingViewModel();
public string CurrentPcbID
public String CurrentPcbID
{
set
{
@@ -101,10 +97,7 @@ namespace ProductionUiCordonel
}
}
get
{
return _currentPcbID;
}
get => _currentPcbID;
}
public enum uiState
@@ -121,24 +114,18 @@ namespace ProductionUiCordonel
_currentState = value;
updateUi(lblState, _currentState.ToString());
}
get
{
return _currentState;
}
get => _currentState;
}
private string _lastMsg;
public string LastMsg
private String _lastMsg;
public String LastMsg
{
set
{
_lastMsg = value;
updateUi(lblMessage, _lastMsg);
}
get
{
return _lastMsg;
}
get => _lastMsg;
}
public MainWindow()
@@ -160,9 +147,10 @@ namespace ProductionUiCordonel
}
public ApplicationSettings Settings { get; set; }
private void Window_Initialized(object sender, EventArgs e)
private void Window_Initialized(Object sender, EventArgs e)
{
var configfile = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), nameof(Xylem.Common.Hardware.WaterMeter.Genesis), ProgramConfig.SerialConfigFileName);
var configfile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
nameof(Xylem.Common.Hardware.WaterMeter.Genesis), ProgramConfig.SerialConfigFileName);
if (!File.Exists(configfile))
{
@@ -189,7 +177,7 @@ namespace ProductionUiCordonel
useSetting(true);
}
private void TmrAutoDetect_Elapsed(object sender, ElapsedEventArgs e)
private void TmrAutoDetect_Elapsed(Object sender, ElapsedEventArgs e)
{
tmrAutoDetect.Enabled = false;
var hasDetect = Detect(true, 1);
@@ -205,25 +193,25 @@ namespace ProductionUiCordonel
}
private void BtnConntect_Click(object sender, RoutedEventArgs e)
private void BtnConnect_Click(Object sender, RoutedEventArgs e)
{
var hasDetect = Detect(false, (int)cbxSlotBox.SelectedValue);
var hasDetect = Detect(false, (Int32)cbxSlotBox.SelectedValue);
Settings.Slot = (int)cbxSlotBox.SelectedValue;
Settings.Slot = (Int32)cbxSlotBox.SelectedValue;
storeSetting();
}
private void updateUi(ContentControl c, string content)
private void updateUi(ContentControl c, String content)
{
c.Dispatcher.Invoke(DispatcherPriority.Normal,
new Action(() => { c.Content = content; }));
}
private void updateUi(TextBox c, string content)
private void updateUi(TextBox c, String content)
{
c.Dispatcher.Invoke(DispatcherPriority.Normal,
new Action(() => { c.Text = content; }));
}
private void updateUi(TextBlock c, string content)
private void updateUi(TextBlock c, String content)
{
c.Dispatcher.Invoke(DispatcherPriority.Normal,
new Action(() => { c.Text = content; }));
@@ -231,11 +219,11 @@ namespace ProductionUiCordonel
private MeterBatch CurrentBatch;
private GenesisMeter _currentMeter;
private bool detectIsLocked;
private Boolean detectIsLocked;
private GenesisMeter CurrentMeter
{
get { return _currentMeter; }
get => _currentMeter;
set
{
_currentMeter = value;
@@ -254,12 +242,12 @@ namespace ProductionUiCordonel
}
}
private bool Detect(bool IgnorErrors, int slot)
private Boolean Detect(Boolean ignoreErrors, Int32 slot)
{
if (!detectIsLocked)
{
LastMsg = "Start Detect";
bool hasDetect = false;
Boolean hasDetect = false;
if (string.IsNullOrEmpty(CurrentPcbID) || CurrentMeter == null)
{
var mb = new MeterBatch();
@@ -283,14 +271,14 @@ namespace ProductionUiCordonel
}
else
{
LastMsg = $"No Meter found";
LastMsg = "No Meter found";
DisposeAllConnections();
}
}
catch (Exception e)
{
if (!IgnorErrors)
if (!ignoreErrors)
{
MessageBox.Show($"Error occur.{ Environment.NewLine} {e.Message}");
}
@@ -318,16 +306,14 @@ namespace ProductionUiCordonel
}
return hasDetect;
}
else
{
LastMsg = "Meter is still connected (locked)";
return true;
}
LastMsg = "Meter is still connected (locked)";
return true;
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
private void Window_Closing(Object sender, CancelEventArgs e)
{
DisposeAllConnections();
}
@@ -351,7 +337,7 @@ namespace ProductionUiCordonel
private void GetPcbMapping(string pcbID)
private void GetPcbMapping(String pcbID)
{
if (string.IsNullOrEmpty(pcbID))
{
@@ -364,7 +350,7 @@ namespace ProductionUiCordonel
try
{
var responseJson = LocalWebRequest.GetRequest(url);
var a = JsonConvert.DeserializeObject<string[]>(responseJson);
var a = JsonConvert.DeserializeObject<String[]>(responseJson);
if (ucFinalRadioTest != null)
@@ -380,7 +366,7 @@ namespace ProductionUiCordonel
}
ucFinalRadioTest.RadioAdress = tmpInt;
ucFinalRadioTest.RadioAddress = tmpInt;
ucFinalRadioTest.SerialNumber = a[0] + "/" + a[3];
}
@@ -405,38 +391,38 @@ namespace ProductionUiCordonel
private void Button_Click(object sender, RoutedEventArgs e)
private void Button_Click(Object sender, RoutedEventArgs e)
{
}
private void UcFinalRadioTest_Loaded(object sender, RoutedEventArgs e)
private void UcFinalRadioTest_Loaded(Object sender, RoutedEventArgs e)
{
ucFinalRadioTest.OnLockMeter += UcFinalRadioTest_OnLockMeter;
ucFinalRadioTest.OnReleaseMeter += UcFinalRadioTest_OnReleaseMeter;
}
private void UcFinalRadioTest_OnLockMeter(object sender, EventArgs e)
private void UcFinalRadioTest_OnLockMeter(Object sender, EventArgs e)
{
detectIsLocked = true;
}
private void UcFinalRadioTest_OnReleaseMeter(object sender, EventArgs e)
private void UcFinalRadioTest_OnReleaseMeter(Object sender, EventArgs e)
{
detectIsLocked = false;
ucFinalRadioTest.SetUpBlank(false);
}
private void BtnSwitchAutoDetect_Click(object sender, RoutedEventArgs e)
private void BtnSwitchAutoDetect_Click(Object sender, RoutedEventArgs e)
{
Settings.AutoDetect = !Settings.AutoDetect;
storeSetting();
useSetting();
}
private void CbxSlotBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
private void CbxSlotBox_SelectionChanged(Object sender, SelectionChangedEventArgs e)
{
}
@@ -447,7 +433,7 @@ namespace ProductionUiCordonel
private void useSetting(bool setSlot = false)
private void useSetting(Boolean setSlot = false)
{
tmrAutoDetect.Enabled = Settings.AutoDetect;
tblkAutodetectState.Text = "Off";
@@ -463,7 +449,7 @@ namespace ProductionUiCordonel
ucFinalRadioTest.OrderHasChanged += delegate (Object sender, EventArgs args)
ucFinalRadioTest.OrderHasChanged += delegate
{
txtOrderNr.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => { txtOrderNr.Text = ucFinalRadioTest.OrderNumber.ToString(); }));
};
@@ -474,7 +460,7 @@ namespace ProductionUiCordonel
}
private void StackPanel_SizeChanged(object sender, SizeChangedEventArgs e)
private void StackPanel_SizeChanged(Object sender, SizeChangedEventArgs e)
{
ucFinalRadioTest.Height = e.NewSize.Height;
@@ -0,0 +1,187 @@
using System;
using System.Threading;
using ProductionUiCordonel.Data;
using Xylem.Common.Utils.ProcessExec.EventArguments;
namespace ProductionUiCordonel.Model
{
/// <summary>
/// Final test model preparing the Cordonel for shipping:
/// - Setup device with standard parameters covered by the VAKO or customer specific CSD,
/// - If radio is installed: radio test,
/// - Requiring radio key from LuDB,
/// - Requiring 7 passwords for the Cordonel access levels,
/// - Building the password file (Level 3 is the modified skeleton key),
/// - Store all configurations,
/// - Reboot the Cordonel to load all settings from FLASH to RAM,
/// - Configuration check of all parameters defined by VAKO and CSD.
/// </summary>
class FinalTestModel
{
#region Variables
/// <summary>
/// Port scan result event for message dispatcher to caller
/// </summary>
public event EventHandler<ProcessExecEventArgs> OnProcessUpdate;
// Text for caller to inform about actual process being carried out
private String _actualOperation;
// states of the state machine, the backup state locks against repeated execution
private FinalTestState _finalTestState;
private FinalTestState _finalTestBackupState;
// Process counter for caller to monitor actual progress
private Int32 _overallProcessedStepsCtr;
private Int32 _singleProcessedStepsCtr;
// maximum processing steps for calculation of progress bar
private const Int32 MaxOverallProcessSteps = 20;
private Int32 _maxSingleProcessSteps;
// processing retries
private const Int32 MaxProcessRetries = 2;
private Int32 _processRetryCtr;
#endregion
#region Events
/// <summary>
/// Process event
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <remarks date="2023-Jan-17" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
public virtual void ProcessUpdate_Event(Object sender, ProcessExecEventArgs e)
{
// copy text from overall messages to actual, because this is from sub-routine
OnProcessUpdate?.Invoke(this, new ProcessExecEventArgs(GetActualStateText(),
OverallProcessPercent, _actualOperation, e.OverallProcessPercent));
}
#endregion
#region ProcessInformation
/// <summary>
/// Process counter in percent
/// </summary>
/// <remarks date="2023-Jan-17" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
public Double OverallProcessPercent => 100.0d *
(_overallProcessedStepsCtr + _singleProcessedStepsCtr) / MaxOverallProcessSteps;
/// <summary>
/// Single file process counter in percent
/// </summary>
/// <remarks date="2023-Jan-17" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
public Double SingleFileProcessPercent => 100.0d * _singleProcessedStepsCtr / _maxSingleProcessSteps;
/// <summary>
/// Returns the final test state text information for display
/// </summary>
/// <returns></returns>
/// <remarks date="2023-Jan-17" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
public String GetActualStateText()
{
// search text assigned to current state
var text = FinalTestStateInfo.GetTextFromState(_finalTestState);
if (_finalTestState == FinalTestState.Idle)
{
return text;
}
text += _processRetryCtr > 0 ? $"{_processRetryCtr}" : "";
if (_overallProcessedStepsCtr > 0)
{
text += $"{_overallProcessedStepsCtr}/{MaxOverallProcessSteps}";
}
return text;
}
#endregion
#region CtorAssignment
/// <summary>
/// Ctor
/// </summary>
/// <remarks date="2023-Jan-17" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
public FinalTestModel()
{
}
/// <summary>
/// Dispose
/// </summary>
public void Dispose()
{
}
#endregion
#region StateMachine
/// <summary>
/// State machine of FinalTestModel.
/// </summary>
/// <remarks date="2023-Jan-17" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
public void StateMachine()
{
// avoid repeated execution of the state machine of identical state
if (_finalTestState == _finalTestBackupState)
{
Thread.Sleep(1);
}
else
{
// remind backup state to avoid repeated execution and side effects
_finalTestBackupState = _finalTestState;
switch (_finalTestState)
{
case FinalTestState.Idle:
break;
case FinalTestState.StartInitial:
_overallProcessedStepsCtr = 0;
_singleProcessedStepsCtr = 0;
_finalTestState = FinalTestState.Idle;
break;
case FinalTestState.StepFailed:
_finalTestState = _processRetryCtr++ < MaxProcessRetries
? FinalTestState.RepeatFinalTest
: FinalTestState.FinalTestFailed;
break;
case FinalTestState.RepeatFinalTest:
_overallProcessedStepsCtr = 0;
_singleProcessedStepsCtr = 0;
_finalTestState = FinalTestState.Idle;
break;
default:
_finalTestState = FinalTestState.Idle;
break;
}
}// lock repeated execution of identical state
#endregion
}
}
}
@@ -1,17 +1,12 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace ProductionUiCordonel.Model
{
public interface IMultiModeChildViewModel : INotifyPropertyChanged, IDisposable
{
string GetChildIdent();
String GetChildIdent();
void InputText(string text);
void InputText(String text);
}
}
@@ -1,53 +1,53 @@
using Newtonsoft.Json;
using System;
using System;
using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks;
using System.Windows;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
using Xylem.Common.Logic.ProductionOrderCore;
using Xylem.Common.Logic.SoftwareAccessHelper;
namespace ProductionUiCordonel.Model
{
public class MarriageMultiModeViewModel : BaseMultiModeChildViewModel
{
private bool canMarry = false;
public bool CanMarry
private Boolean canMarry;
public Boolean CanMarry
{
get { return canMarry; }
get => canMarry;
set
{
canMarry = value;
NotifyPropertyChanged(nameof(CanMarry));
NotifyPropertyChanged();
}
}
private int serialNr;
public int SerialNr
private Int32 serialNr;
public Int32 SerialNr
{
get { return serialNr; }
get => serialNr;
set
{
serialNr = value;
NotifyPropertyChanged(nameof(SerialNr));
NotifyPropertyChanged();
}
}
private bool locked = false;
public MarriageMultiModeViewModel(string ctrName, int slotNR, List<string> barcodeTrigger, int? stationID = null) : base(ctrName, slotNR, barcodeTrigger, stationID)
private Boolean locked = false;
public MarriageMultiModeViewModel(String ctrName, Int32 slotNR, List<String> barcodeTrigger, Int32? stationID = null) :
base(ctrName, slotNR, barcodeTrigger, stationID)
{
base.VisibilityMarriage = System.Windows.Visibility.Visible;
base.MeterDetectedHandler += PickingMultiModeViewModel_MeterDetectedHandler;
VisibilityMarriage = Visibility.Visible;
MeterDetectedHandler += PickingMultiModeViewModel_MeterDetectedHandler;
}
internal async Task<bool> Store()
internal async Task<Boolean> Store()
{
var url = $"{ServiceUrls.MarriageServiceUrl()}SetPcbToSerial?PcbId={CurrentPcbID}&SerialNumber={SerialNr}&returnMetroData=0";
return await Task<bool>.Run(() =>
return await Task<Boolean>.Run(() =>
{
try
{
@@ -76,11 +76,9 @@ namespace ProductionUiCordonel.Model
return true;
}
else
{
Log($"No result for {url} on Store");
return false;
}
Log($"No result for {url} on Store");
return false;
}
@@ -102,7 +100,7 @@ namespace ProductionUiCordonel.Model
});
}
private void PickingMultiModeViewModel_MeterDetectedHandler(object sender, EventArgs e)
private void PickingMultiModeViewModel_MeterDetectedHandler(Object sender, EventArgs e)
{
CheckBtnEnable();
}
@@ -122,7 +120,7 @@ namespace ProductionUiCordonel.Model
public override void InputText(string text)
public override void InputText(String text)
{
try
{
@@ -152,7 +150,7 @@ namespace ProductionUiCordonel.Model
}
public override bool SlotIsLocked()
public override Boolean SlotIsLocked()
{
return locked;
}
@@ -1,11 +1,11 @@
using NLog;
using ProductionUiCordonel.Model;
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Timers;
using System.Windows;
using NLog;
using ProductionUiCordonel.Model;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
using Xylem.Common.Utils.Logging;
@@ -20,70 +20,58 @@ namespace ProductionUiCordonel
private Timer tmrAutoDetect;
public EventHandler OnPcbIdDetect;
public List<string> BarcodeTrigger = new List<string>();
public List<String> BarcodeTrigger = new List<String>();
private int intervalWithoutDetect = 1000;
private int intervalWithDetect = 10000;
private string _currentPcbID;
private Int32 intervalWithoutDetect = 1000;
private Int32 intervalWithDetect = 10000;
private String _currentPcbID;
private MeterBatch Batch = new MeterBatch();
private Visibility visibilityMarriage = Visibility.Collapsed;
public Visibility VisibilityMarriage
{
get
{
return visibilityMarriage;
}
get => visibilityMarriage;
set
{
visibilityMarriage = value;
NotifyPropertyChanged(nameof(VisibilityMarriage));
NotifyPropertyChanged();
}
}
private Visibility visibilityPicking = Visibility.Collapsed;
public Visibility VisibilityPicking
{
get
{
return visibilityPicking;
}
get => visibilityPicking;
set
{
visibilityPicking = value;
NotifyPropertyChanged(nameof(VisibilityPicking));
NotifyPropertyChanged();
}
}
private Visibility visibilityPressure = Visibility.Collapsed;
public Visibility VisibilityPressure
{
get
{
return visibilityPressure;
}
get => visibilityPressure;
set
{
visibilityPressure = value;
NotifyPropertyChanged(nameof(VisibilityPressure));
NotifyPropertyChanged();
}
}
public string currentSlotStateText = "none";
public string CurrentSlotStateText
public String currentSlotStateText = "none";
public String CurrentSlotStateText
{
get
{
return currentSlotStateText;
}
get => currentSlotStateText;
set
{
currentSlotStateText = value;
NotifyPropertyChanged(nameof(CurrentSlotStateText));
NotifyPropertyChanged();
}
}
@@ -93,10 +81,7 @@ namespace ProductionUiCordonel
private SlotState currentSlotState = SlotState.None;
public SlotState CurrentSlotState
{
get
{
return currentSlotState;
}
get => currentSlotState;
set
{
currentSlotState = value;
@@ -126,22 +111,20 @@ namespace ProductionUiCordonel
case SlotState.Fatal:
CurrentSlotStateText = "Schwerwiegender Fehler";
break;
default:
break;
}
NotifyPropertyChanged(nameof(CurrentSlotState));
NotifyPropertyChanged();
}
}
private string slotInfo = "-";
private String slotInfo = "-";
public String SlotInfo
{
get { return slotInfo; }
get => slotInfo;
set
{
slotInfo = value;
NotifyPropertyChanged(nameof(SlotInfo));
NotifyPropertyChanged();
}
}
@@ -157,40 +140,37 @@ namespace ProductionUiCordonel
Error,
Fatal
}
private string childName = "asd";
private String childName = "asd";
public String ChildName
{
get { return childName; }
get => childName;
set
{
childName = value;
NotifyPropertyChanged(nameof(ChildName));
NotifyPropertyChanged();
}
}
private string order;
private String order;
public String Order
{
get { return order; }
get => order;
set
{
order = value;
NotifyPropertyChanged(nameof(Order));
NotifyPropertyChanged();
}
}
public string CurrentPcbID
public String CurrentPcbID
{
get
{
return _currentPcbID;
}
get => _currentPcbID;
set
{
_currentPcbID = value;
NotifyPropertyChanged(nameof(CurrentPcbID));
NotifyPropertyChanged();
}
}
@@ -204,14 +184,14 @@ namespace ProductionUiCordonel
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public string GetChildIdent()
public String GetChildIdent()
{
return ChildName;
}
public int SlotNr;
public BaseMultiModeChildViewModel(string ctrName, int slotNR,List<string> barcodeTrigger, int? StationId = null, bool useTimer = true)
public Int32 SlotNr;
public BaseMultiModeChildViewModel(String ctrName, Int32 slotNR,List<String> barcodeTrigger, Int32? StationId = null, Boolean useTimer = true)
{
_logger = NLogHelper.CreateOrGetLogger("ProductionUI");
ChildName = ctrName;
@@ -227,7 +207,7 @@ namespace ProductionUiCordonel
BarcodeTrigger = barcodeTrigger;
}
public void TmrAutoDetect_Elapsed(object sender, EventArgs e)
public void TmrAutoDetect_Elapsed(Object sender, EventArgs e)
{
CurrentSlotState = SlotState.IsDetecting;
tmrAutoDetect.Enabled = false;
@@ -255,24 +235,24 @@ namespace ProductionUiCordonel
}
}
public virtual void InputText(string text)
public virtual void InputText(String text)
{
Order = text;
}
public void Log(string txt)
public void Log(String txt)
{
_logger?.Info(txt);
}
public abstract bool SlotIsLocked();
public abstract Boolean SlotIsLocked();
public event EventHandler MeterDetectedHandler;
private bool Detect(int slot)
private Boolean Detect(Int32 slot)
{
if (!SlotIsLocked())
{
Log("Start Detect");
bool hasDetect = false;
Boolean hasDetect = false;
if (string.IsNullOrEmpty(CurrentPcbID) || CurrentMeter == null)
{
Batch = new MeterBatch();
@@ -294,7 +274,7 @@ namespace ProductionUiCordonel
}
else
{
Log($"No Meter found");
Log("No Meter found");
DisposeAllConnections();
}
@@ -325,11 +305,9 @@ namespace ProductionUiCordonel
}
return hasDetect;
}
else
{
Log("Meter is still connected (locked)");
return true;
}
Log("Meter is still connected (locked)");
return true;
}
private void DisposeAllConnections()
@@ -1,6 +1,4 @@
using Logic.ProductionToProductMapper.Cordonel;
using Newtonsoft.Json;
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO.Ports;
@@ -8,81 +6,69 @@ using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Media;
using Logic.ProductionToProductMapper.Cordonel;
using Newtonsoft.Json;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
using Xylem.Common.Logic.ProductionOrderCore.OrderData;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
using Xylem.Common.Logic.SoftwareAccessHelper;
namespace ProductionUiCordonel.Model
{
internal class MultiModeMasterViewModel : INotifyPropertyChanged
{
private string pickingState = "Warte auf Scanner";
private string pickingScanner = "keine Verbindung";
private string pickingSlot = "-";
private string pickingResult = "-";
private String pickingState = "Warte auf Scanner";
private String pickingScanner = "keine Verbindung";
private String pickingSlot = "-";
private String pickingResult = "-";
private System.Windows.Media.Brush pickingResultColor;
public System.Windows.Media.Brush PickingResultColor
private Brush pickingResultColor;
public Brush PickingResultColor
{
get
{
return pickingResultColor;
}
get => pickingResultColor;
set
{
pickingResultColor = value;
NotifyPropertyChanged(nameof(PickingResultColor));
NotifyPropertyChanged();
}
}
public string PickingState
public String PickingState
{
get
{
return pickingState;
}
get => pickingState;
set
{
pickingState = value;
NotifyPropertyChanged(nameof(PickingState));
NotifyPropertyChanged();
}
}
public string PickingScanner
public String PickingScanner
{
get
{
return pickingScanner;
}
get => pickingScanner;
set
{
pickingScanner = value;
NotifyPropertyChanged(nameof(PickingScanner));
NotifyPropertyChanged();
}
}
public string PickingSlot
public String PickingSlot
{
get
{
return pickingSlot;
}
get => pickingSlot;
set
{
pickingSlot = value;
NotifyPropertyChanged(nameof(PickingSlot));
NotifyPropertyChanged();
}
}
public string PickingResult
public String PickingResult
{
get
{
return pickingResult;
}
get => pickingResult;
set
{
pickingResult = value;
NotifyPropertyChanged(nameof(PickingResult));
NotifyPropertyChanged();
}
}
public event PropertyChangedEventHandler PropertyChanged;
@@ -117,12 +103,12 @@ namespace ProductionUiCordonel.Model
private class BarScanner : IDisposable
{
private bool isRuning = false;
private Boolean isRuning;
public String Input = "";
private String Port;
private CancellationToken Cancellation;
private Task WaitForScannerTask;
public BarScanner(string port, CancellationToken cancellation)
public BarScanner(String port, CancellationToken cancellation)
{
Port = port;
Cancellation = cancellation;
@@ -148,13 +134,11 @@ namespace ProductionUiCordonel.Model
isRuning = false;
break;
}
else
{
Input = a.ReadLine();
a.Close();
isRuning = false;
break;
}
Input = a.ReadLine();
a.Close();
isRuning = false;
break;
}
}
@@ -175,7 +159,7 @@ namespace ProductionUiCordonel.Model
}
public bool Compare(Dictionary<UInt32, UInt32> checkAppsIdVersion, uint Frequency, uint MeterSize, bool PressurePresent)
public Boolean Compare(Dictionary<UInt32, UInt32> checkAppsIdVersion, UInt32 Frequency, UInt32 MeterSize, Boolean PressurePresent)
{
using (var Batch = new MeterBatch())
{
@@ -186,14 +170,14 @@ namespace ProductionUiCordonel.Model
meter.SetupFromConfigFile(PickingSlotNr);
Batch.AddMeter(meter);
PickingState = "Am Zähler anmelden";
if ((bool)meter.Login())
if (meter.Login())
{
meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingStarted);
meter.SetProcessState(DisplayCodes.PickingStarted);
var ret = RunCheck(checkAppsIdVersion, Frequency, MeterSize, PressurePresent, meter);
if (ret)
{
meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingTested);
meter.SetProcessState(DisplayCodes.PickingTested);
var url = $"{ServiceUrls.MeterProcessStateUrl()}SetPickingState?PcbID={meter.PcbId}&FertigungsauftragsNr={PickingOrder}";
var RetString = LocalWebRequest.PostRequestAsyncAndGetContent(url);
@@ -206,7 +190,7 @@ namespace ProductionUiCordonel.Model
}
else
{
meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingFailed);
meter.SetProcessState(DisplayCodes.PickingFailed);
}
}
}
@@ -214,9 +198,9 @@ namespace ProductionUiCordonel.Model
return false;
}
private bool RunCheck(Dictionary<uint, uint> checkAppsIdVersion, uint Frequency, uint MeterSize, bool PressurePresent, GenesisMeter meter)
private Boolean RunCheck(Dictionary<UInt32, UInt32> checkAppsIdVersion, UInt32 Frequency, UInt32 MeterSize, Boolean PressurePresent, GenesisMeter meter)
{
PickingState = $"Üperprüfe Parameter";
PickingState = "Üperprüfe Parameter";
var FrequencyReadOut = RegisterConverter.ConvertTo<UInt32>(meter.ReadRegister("SENSUSRADIO_FrequencyIndicator"));
if (FrequencyReadOut != Frequency)
{
@@ -232,16 +216,16 @@ namespace ProductionUiCordonel.Model
}
var PressureReadOut = RegisterConverter.ConvertTo<bool>(meter.ReadRegister("METROLOGYASST_PressurePresent"));
var PressureReadOut = RegisterConverter.ConvertTo<Boolean>(meter.ReadRegister("METROLOGYASST_PressurePresent"));
if (PressureReadOut != PressurePresent)
{
if (PressurePresent)
{
PickingState = $"Pcb mit Drucksensor. Laut Auftrag keine verbaut";
PickingState = "Pcb mit Drucksensor. Laut Auftrag keine verbaut";
}
else
{
PickingState = $"Pcb ohne Drucksensor. Laut Auftrag soll eine verbaut werden";
PickingState = "Pcb ohne Drucksensor. Laut Auftrag soll eine verbaut werden";
}
//todo raus
return false;
@@ -255,14 +239,14 @@ namespace ProductionUiCordonel.Model
var MeterFWApp = meter.MeterAppListVersion.First(a => item.Key == a.AppId);
if (MeterFWApp == null || MeterFWApp.Version != item.Value)
{
PickingState = $"Falsche FW, bitte Updaten";
PickingState = "Falsche FW, bitte Updaten";
return false;
}
}
catch (Exception)
{
PickingState = $"Fehler beim auslesen der FW";
PickingState = "Fehler beim auslesen der FW";
return false;
}
@@ -277,14 +261,14 @@ namespace ProductionUiCordonel.Model
var storeRet = meter.ReadRegister("METROLOGYASST_StoreConfiguration");
if (!storeRet.All(a => a.Equals(0)))
{
PickingState = $"Filesystem corrupt";
PickingState = "Filesystem corrupt";
return false;
}
}
catch (Exception)
{
PickingState = $"Fehler beim überprüfen des Filesystems";
PickingState = "Fehler beim überprüfen des Filesystems";
return false;
}
@@ -293,12 +277,12 @@ namespace ProductionUiCordonel.Model
private PickingCompareItem PickingOrderDetails;
private BarScanner PickingBarScanner;
private string PickingOrder;
private string PickingPcbId;
private String PickingOrder;
private String PickingPcbId;
private string PickingScannerPort = "COM6";
private int PickingSlotNr = 1;
private String PickingScannerPort = "COM6";
private Int32 PickingSlotNr = 1;
//PickingState,PickingScanner,PickingSlot,PickingResult
private void PickingLoop(CancellationToken token)
{
@@ -328,7 +312,7 @@ namespace ProductionUiCordonel.Model
case PickingStateMachine.WaitForScanning:
PickingScanner = $"Offen {PickingScannerPort}";
PickingState = $"Warte auf Scannereingabe({PickingScannerPort})";
if (PickingBarScanner != null && !String.IsNullOrEmpty(PickingBarScanner.Input))
if (PickingBarScanner != null && !string.IsNullOrEmpty(PickingBarScanner.Input))
{
PickingOrder = PickingBarScanner.Input;
PickingScanner = $"Geschlossen {PickingScannerPort}";
@@ -348,7 +332,7 @@ namespace ProductionUiCordonel.Model
{
try
{
PickingState = $"Warte auf Pcb";
PickingState = "Warte auf Pcb";
PickingSlot = $"Öffne EP {PickingSlotNr}";
tryMeter.SetupFromConfigFile(PickingSlotNr);
Batch.AddMeter(tryMeter);
@@ -368,7 +352,7 @@ namespace ProductionUiCordonel.Model
else
{
PickingSlot = $"Keine Konnektivität EP {PickingSlotNr}";
Log($"No Meter found");
Log("No Meter found");
}
@@ -414,11 +398,11 @@ namespace ProductionUiCordonel.Model
PickingState = $"Vergleiche Auftragsdaten {PickingOrder} mit Pcb Eigenschaften";
var converter = new System.Windows.Media.BrushConverter();
var converter = new BrushConverter();
if (Compare(PickingOrderDetails.CheckAppsIdVersion, PickingOrderDetails.FrequencyIndicator, PickingOrderDetails.MeterSize, PickingOrderDetails.PressurePresent))
{
//erfolg anzeigen und weiter
var b = (System.Windows.Media.Brush)converter.ConvertFromString("#419C14");
var b = (Brush)converter.ConvertFromString("#419C14");
b.Freeze();
PickingResultColor = b;
sm = PickingStateMachine.MeterDone;
@@ -427,15 +411,15 @@ namespace ProductionUiCordonel.Model
{
sm = PickingStateMachine.MeterError;
var b = (System.Windows.Media.Brush)converter.ConvertFromString("#FF8000");
var b = (Brush)converter.ConvertFromString("#FF8000");
b.Freeze();
PickingResultColor = b;
}
break;
case PickingStateMachine.MeterError:
PickingOrderDetails = null;
PickingState = $"Vergleich abgeschlossen";
PickingResult = $"Vergleich fertig fehlgeschlagen";
PickingState = "Vergleich abgeschlossen";
PickingResult = "Vergleich fertig fehlgeschlagen";
Thread.Sleep(10000);
sm = PickingStateMachine.StartCom;
@@ -443,7 +427,7 @@ namespace ProductionUiCordonel.Model
case PickingStateMachine.MeterDone:
PickingState = $"Vergleich abgeschlossen warten auf Montage Rückmeldung";
PickingState = "Vergleich abgeschlossen warten auf Montage Rückmeldung";
PickingResult = $"Pcb {PickingPcbId} wurde dem Auftrag {PickingOrder} hinzugefügt";
Thread.Sleep(10000);
PickingScanner = $"Öfffne {PickingScannerPort}";
@@ -459,7 +443,7 @@ namespace ProductionUiCordonel.Model
break;
case PickingStateMachine.WaitForBuildingMeterReady:
if (PickingBarScanner != null && !String.IsNullOrEmpty(PickingBarScanner.Input))
if (PickingBarScanner != null && !string.IsNullOrEmpty(PickingBarScanner.Input))
{
if (PickingBarScanner.Input == "%Cordonel_SAP_100%")
@@ -480,12 +464,12 @@ namespace ProductionUiCordonel.Model
PickingBarScanner = new BarScanner(PickingScannerPort, token);
PickingBarScanner.Start();
PickingState = $"Montage Rückmeldung erhalten, Montage des Drucksensors bestätigen";
PickingState = "Montage Rückmeldung erhalten, Montage des Drucksensors bestätigen";
sm = PickingStateMachine.WaitForBuildingPressureReady;
}
else
{
PickingState = $"Montage Rückmeldung erhalten, auftrag Scannen";
PickingState = "Montage Rückmeldung erhalten, auftrag Scannen";
sm = PickingStateMachine.StartCom;
}
}
@@ -493,7 +477,7 @@ namespace ProductionUiCordonel.Model
break;
case PickingStateMachine.WaitForBuildingPressureReady:
if (PickingBarScanner != null && !String.IsNullOrEmpty(PickingBarScanner.Input))
if (PickingBarScanner != null && !string.IsNullOrEmpty(PickingBarScanner.Input))
{
if (PickingBarScanner.Input == "%Cordonel_SAP_101%")
@@ -508,13 +492,11 @@ namespace ProductionUiCordonel.Model
{
}
PickingState = $"Montage Rückmeldung erhalten, auftrag Scannen";
PickingState = "Montage Rückmeldung erhalten, auftrag Scannen";
sm = PickingStateMachine.StartCom;
}
}
break;
default:
break;
}
Thread.Sleep(1000);
@@ -522,7 +504,7 @@ namespace ProductionUiCordonel.Model
}
private void Log(string v)
private void Log(String v)
{
//throw new NotImplementedException();
}
@@ -1,74 +1,71 @@
using Logic.ProductionToProductMapper.Cordonel;
using Newtonsoft.Json;
using ProductionUiCordonel.Data;
using System;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Timers;
using System.Windows;
using System.Windows.Media;
using Logic.ProductionToProductMapper.Cordonel;
using Newtonsoft.Json;
using ProductionUiCordonel.Data;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
using Xylem.Common.Logic.ProductionOrderCore.OrderData;
using Xylem.Common.Logic.SoftwareAccessHelper;
using MessageBox = System.Windows.Forms.MessageBox;
namespace ProductionUiCordonel.Model
{
public class PickingMultiModeViewModel : BaseMultiModeChildViewModel
{
private bool inputIsEnabled = false;
public bool InputIsEnabled
private Boolean inputIsEnabled;
public Boolean InputIsEnabled
{
get { return inputIsEnabled; }
get => inputIsEnabled;
set
{
inputIsEnabled = value;
NotifyPropertyChanged(nameof(InputIsEnabled));
NotifyPropertyChanged();
}
}
private bool locked = false;
public PickingMultiModeViewModel(string ctrName, int slotNR, List<string> barcodeTrigger, int? stationID = null) : base(ctrName, slotNR, barcodeTrigger, stationID,false)
private Boolean locked;
public PickingMultiModeViewModel(String ctrName, Int32 slotNR, List<String> barcodeTrigger, Int32? stationID = null) : base(ctrName, slotNR, barcodeTrigger, stationID, false)
{
VisibilityPicking = Visibility.Visible;
base.MeterDetectedHandler += PickingMultiModeViewModel_MeterDetectedHandler;
MeterDetectedHandler += PickingMultiModeViewModel_MeterDetectedHandler;
}
private void PickingMultiModeViewModel_MeterDetectedHandler(object sender, EventArgs e)
private void PickingMultiModeViewModel_MeterDetectedHandler(Object sender, EventArgs e)
{
}
public override bool SlotIsLocked()
public override Boolean SlotIsLocked()
{
return locked;
}
public override void InputText(string text)
public override void InputText(String text)
{
Order = text;
ReloadData(false);
ReloadData();
TextForceUpdate();
}
internal void ReloadData(bool reset)
internal void ReloadData()
{
Task.Run(() =>
{
try
{
var orderNR = 0;
if (!locked && !string.IsNullOrEmpty(Order) && Order.Length > 6 && int.TryParse(Order, out orderNR))
if (!locked && !string.IsNullOrEmpty(Order) && Order.Length > 6 && int.TryParse(Order, out var orderNR))
{
var str = LocalWebRequest.GetRequest($"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetOrderOverview?ProductionOrderNumber={orderNR}");
@@ -82,12 +79,11 @@ namespace ProductionUiCordonel.Model
return;
}
var retCode = 0;
str = LocalWebRequest.GetRequestWithError($"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetOrderDetails?ProductionOrderNumber={orderNR}&CheckPcbId={CurrentMeter.PcbId}",out retCode, 15000);
str = LocalWebRequest.GetRequestWithError($"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetOrderDetails?ProductionOrderNumber={orderNR}&CheckPcbId={CurrentMeter.PcbId}", out var retCode, 15000);
if (retCode == 417)
{
System.Windows.Forms.MessageBox.Show("NO radio parameter found");
MessageBox.Show(@"NO radio parameter found");
}
if (OrderOverView.Count == OrderOverView.AssignedPicking)
@@ -98,61 +94,52 @@ namespace ProductionUiCordonel.Model
return;
}
try
var OrderDteails = JsonConvert.DeserializeObject<PickingCompareItem>(str);
if (CurrentMeter != null)
{
var OrderDteails = JsonConvert.DeserializeObject<PickingCompareItem>(str);
if (CurrentMeter != null)
try
{
try
locked = true;
//Init(CurrentMeter, new Dictionary<uint, uint>(), OrderDteails.FrequencyIndicator, OrderDteails.MeterSize, OrderDteails.PressurePresent);
var a = new Dictionary<UInt32, UInt32>();
a.Add(0, 486);
a.Add(15, 287);
if (OrderDteails.FrequencyIndicator == 868)
{
locked = true;
//Init(CurrentMeter, new Dictionary<uint, uint>(), OrderDteails.FrequencyIndicator, OrderDteails.MeterSize, OrderDteails.PressurePresent);
var a = new Dictionary<uint, uint>();
a.Add(0, 486);
a.Add(15, 287);
if (OrderDteails.FrequencyIndicator == 868)
{
a.Add(24, 1067);
}
else
{
a.Add(24, 1066);
}
Init(CurrentMeter, a, OrderDteails.FrequencyIndicator, OrderDteails.MeterSize, OrderDteails.PressurePresent);
var r = Run(CurrentMeter.PcbId, orderNR.ToString());
if (r)
{
doneCount = doneCount + 1;
}
locked = false;
UpdatePickingUi("Start checking meter", StatusColor, orderNR.ToString(), OrderOverView.Count, doneCount);
a.Add(24, 1067);
}
catch (Exception ex)
else
{
Log(ex.Message);
a.Add(24, 1066);
}
finally
Init(CurrentMeter, a, OrderDteails.FrequencyIndicator, OrderDteails.MeterSize, OrderDteails.PressurePresent);
var r = Run(CurrentMeter.PcbId, orderNR.ToString());
if (r)
{
locked = false;
doneCount = doneCount + 1;
}
locked = false;
UpdatePickingUi("Start checking meter", StatusColor, orderNR.ToString(), OrderOverView.Count, doneCount);
}
catch (Exception ex)
{
Log(ex.Message);
}
finally
{
locked = false;
}
}
catch (Exception)
{
throw;
}
}
else
{
@@ -167,7 +154,7 @@ namespace ProductionUiCordonel.Model
});
}
private void UpdatePickingUi(string state, System.Windows.Media.Brush StateColor, string order, int toDo, int done)
private void UpdatePickingUi(String state, Brush StateColor, String order, Int32 toDo, Int32 done)
{
Message = state;
Order = order;
@@ -210,17 +197,19 @@ namespace ProductionUiCordonel.Model
public event EventHandler OnDataChanged;
public event EventHandler OnUpdateUi;
public event PropertyChangedEventHandler PropertyChanged;
public new event PropertyChangedEventHandler PropertyChanged;
private GenesisMeter currentMeter;
private PickingCompareItem baseFile;
public ObservableCollection<IPickingResultData> Data { get; set; }
public ObservableCollection<IPickingResultData> Data
{
get; set;
}
private OverallStatus status = OverallStatus.NoDetect;
private OverallStatus Status
{
get { return status; }
get => status;
set
{
status = value;
@@ -228,7 +217,10 @@ namespace ProductionUiCordonel.Model
}
}
public string Message { get; set; }
public String Message
{
get; set;
}
private enum OverallStatus
{
NoDetect,
@@ -237,7 +229,7 @@ namespace ProductionUiCordonel.Model
CheckingIsNoMatch,
CheckingIsHasError,
}
public string StatusText
public String StatusText
{
get
{
@@ -258,7 +250,7 @@ namespace ProductionUiCordonel.Model
}
}
public System.Windows.Media.Brush StatusColor
public Brush StatusColor
{
get
{
@@ -278,58 +270,85 @@ namespace ProductionUiCordonel.Model
}
}
public int ToDo { get; private set; }
public int Done { get; private set; }
public Int32 ToDo
{
get; private set;
}
public Int32 Done
{
get; private set;
}
public void Init(GenesisMeter meter, Dictionary<UInt32, UInt32> checkAppsIdVersion, uint Frequency, uint MeterSize, bool PressurePresent)
public void Init(GenesisMeter meter, Dictionary<UInt32, UInt32> checkAppsIdVersion, UInt32 Frequency, UInt32 MeterSize, Boolean PressurePresent)
{
currentMeter = meter;
var data = new List<IPickingResultData>();
data.Add(new PickingResultCustomCheckData(delegate ()
data.Add(new PickingResultCustomCheckData(delegate
{
var r = meter.Login();
meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingStarted);
return new PickingItemCheckReturn() { Result = true, Msg = "done" };
meter.Login();
meter.SetProcessState(DisplayCodes.PickingStarted);
return new PickingItemCheckReturn { Result = true, Msg = "done" };
})
{ Index = data.Count, Ident = "Login", CheckText = "Try to access Meter", HasError = false, Result = null, CurrentValueText = "-" });
{
Index = data.Count, Ident = "Login", CheckText = "Try to access Meter", HasError = false, Result = null,
CurrentValueText = "-"
});
data.Add(new PickingResultRegisterData() { ReadMeter = meter, Index = data.Count, Ident = "Check Radio", CheckText = $"{Frequency}MHz", CompareObject = Frequency, CurrentValueText = "none", HasError = false, Result = null, RegisterIdent = "SENSUSRADIO_FrequencyIndicator" }); ;
data.Add(new PickingResultRegisterData
{
ReadMeter = meter, Index = data.Count, Ident = "Check Radio", CheckText = $"{Frequency}MHz",
CompareObject = Frequency, CurrentValueText = "none", HasError = false, Result = null,
RegisterIdent = "SENSUSRADIO_FrequencyIndicator"
});
data.Add(new PickingResultRegisterData() { ReadMeter = meter, Index = data.Count, Ident = "MeterSize", CheckText = "DN40-50", CompareObject = MeterSize, CurrentValueText = "none", HasError = false, Result = null, RegisterIdent = "GENESISFLOW_MeterSize" });
data.Add(new PickingResultRegisterData
{
ReadMeter = meter, Index = data.Count, Ident = "MeterSize",
CheckText = "DN40-50", CompareObject = MeterSize, CurrentValueText = "none", HasError = false,
Result = null, RegisterIdent = "GENESISFLOW_MeterSize"
});
data.Add(new PickingResultRegisterData() { ReadMeter = meter, Index = data.Count, Ident = "Pressure", CheckText = "Pressure Sensor", CompareObject = PressurePresent, CurrentValueText = "-", HasError = false, Result = null, RegisterIdent = "METROLOGYASST_PressurePresent" });
data.Add(new PickingResultRegisterData
{
ReadMeter = meter, Index = data.Count, Ident = "Pressure",
CheckText = "Pressure Sensor", CompareObject = PressurePresent, CurrentValueText = "-", HasError = false,
Result = null, RegisterIdent = "METROLOGYASST_PressurePresent"
});
foreach (var item in checkAppsIdVersion)
{
data.Add(new PickingResultCustomCheckData(delegate ()
data.Add(new PickingResultCustomCheckData(delegate
{
try
{
var MeterFWApp = meter.MeterAppListVersion.First(a => item.Key == a.AppId);
if (MeterFWApp == null || MeterFWApp.Version != item.Value)
if (MeterFWApp.Version != item.Value)
{
return new PickingItemCheckReturn() { Result = false, Msg = MeterFWApp.StrVersion };
return new PickingItemCheckReturn { Result = false, Msg = MeterFWApp.StrVersion };
}
return new PickingItemCheckReturn() { Result = true, Msg = MeterFWApp.StrVersion };
return new PickingItemCheckReturn { Result = true, Msg = MeterFWApp.StrVersion };
}
catch (Exception)
{
return new PickingItemCheckReturn() { Result = false, Msg = "error" };
return new PickingItemCheckReturn { Result = false, Msg = "error" };
}
})
{ Index = data.Count, Ident = $"Check AppId {item.Key}", CheckText = $"Version {item.Value}", HasError = false, Result = null, CurrentValueText = "-" }); ;
{
Index = data.Count, Ident = $"Check AppId {item.Key}", CheckText = $"Version {item.Value}",
HasError = false, Result = null, CurrentValueText = "-"
});
}
data.Add(new PickingResultCustomCheckData(delegate ()
data.Add(new PickingResultCustomCheckData(delegate
{
try
{
@@ -338,20 +357,23 @@ namespace ProductionUiCordonel.Model
var storeRet = meter.ReadRegister("METROLOGYASST_StoreConfiguration");
if (storeRet.All(a => a.Equals(0)))
{
return new PickingItemCheckReturn() { Result = true, Msg = "Filesystem OK" };
return new PickingItemCheckReturn { Result = true, Msg = "Filesystem OK" };
}
return new PickingItemCheckReturn() { Result = false, Msg = "Filesystem corrupt" };
return new PickingItemCheckReturn { Result = false, Msg = "Filesystem corrupt" };
}
catch (Exception)
{
return new PickingItemCheckReturn() { Result = false, Msg = "error" };
return new PickingItemCheckReturn { Result = false, Msg = "error" };
}
})
{ Index = data.Count, Ident = $"Check Filesystem", CheckText = $"Check Filesystem", HasError = false, Result = null, CurrentValueText = "checking" }); ;
{
Index = data.Count, Ident = "Check Filesystem", CheckText = "Check Filesystem", HasError = false,
Result = null, CurrentValueText = "checking"
});
Status = OverallStatus.CheckingIsRunning;
ChangeDataData(data);
}
@@ -361,7 +383,7 @@ namespace ProductionUiCordonel.Model
OnDataChanged?.Invoke(Data, EventArgs.Empty);
}
public bool Run(string pcbID, String OrderNr)
public Boolean Run(String pcbID, String OrderNr)
{
var tmpData = Data.ToList();
foreach (var item in tmpData.Where(a => !a.Result.HasValue).OrderBy(a => a.Index))
@@ -374,12 +396,11 @@ namespace ProductionUiCordonel.Model
if (tmpData.All(a => !a.HasError && a.Result.HasValue && a.Result.Value))
{
currentMeter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingTested);
currentMeter.SetProcessState(DisplayCodes.PickingTested);
var url = $"{ServiceUrls.MeterProcessStateUrl()}SetPickingState?PcbID={pcbID}&FertigungsauftragsNr={OrderNr}";
var RetString = LocalWebRequest.PostRequestAsyncAndGetContent(url);
var result = false;
if (bool.TryParse(RetString, out result))
if (bool.TryParse(RetString, out var result))
{
Status = OverallStatus.CheckingIsDone;
return result;
@@ -391,23 +412,18 @@ namespace ProductionUiCordonel.Model
return false;
}
currentMeter.SetProcessState(DisplayCodes.PickingFailed);
if (tmpData.All(a => a.HasError))
{
Status = OverallStatus.CheckingIsHasError;
}
else
{
currentMeter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingFailed);
if (tmpData.All(a => a.HasError))
{
Status = OverallStatus.CheckingIsHasError;
}
else
{
Status = OverallStatus.CheckingIsNoMatch;
}
return false;
Status = OverallStatus.CheckingIsNoMatch;
}
return false;
}
internal void Empty()
@@ -416,5 +432,9 @@ namespace ProductionUiCordonel.Model
ChangeDataData(new List<IPickingResultData>());
}
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
{
PropertyChanged?.Invoke(this, e);
}
}
}
@@ -1,14 +1,15 @@
using Logic.ProductionToProductMapper.Cordonel;
using ProductionUiCordonel.Data;
using System;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Threading;
using System.Windows.Media;
using Logic.ProductionToProductMapper.Cordonel;
using ProductionUiCordonel.Data;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
using Xylem.Common.Logic.SoftwareAccessHelper;
namespace ProductionUiCordonel.Model
@@ -23,14 +24,10 @@ namespace ProductionUiCordonel.Model
public ObservableCollection<IPickingResultData> Data { get; set; }
public PickingViewModel()
{
}
private OverallStatus status = OverallStatus.NoDetect;
private OverallStatus Status
{
get { return status; }
get => status;
set
{
status = value;
@@ -47,7 +44,7 @@ namespace ProductionUiCordonel.Model
CheckingIsNoMatch,
CheckingIsHasError,
}
public string StatusText
public String StatusText
{
get
{
@@ -68,7 +65,7 @@ namespace ProductionUiCordonel.Model
}
}
public System.Windows.Media.Brush StatusColor
public Brush StatusColor
{
get
{
@@ -89,46 +86,46 @@ namespace ProductionUiCordonel.Model
}
public void Init(GenesisMeter meter, Dictionary<UInt32, UInt32> checkAppsIdVersion, uint Frequency, uint MeterSize, bool PressurePresent)
public void Init(GenesisMeter meter, Dictionary<UInt32, UInt32> checkAppsIdVersion, UInt32 Frequency, UInt32 MeterSize, Boolean PressurePresent)
{
currentMeter = meter;
var data = new List<IPickingResultData>();
data.Add(new PickingResultCustomCheckData(delegate ()
{
data.Add(new PickingResultCustomCheckData(delegate
{
var r = meter.Login();
meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingStarted);
return new PickingItemCheckReturn() { Result = true, Msg = "done" };
meter.SetProcessState(DisplayCodes.PickingStarted);
return new PickingItemCheckReturn { Result = true, Msg = "done" };
})
{ Index = data.Count, Ident = "Login", CheckText = "Try to access Meter", HasError = false, Result = null, CurrentValueText = "-" });
if (Frequency != 0)
{
data.Add(new PickingResultRegisterData() { ReadMeter = meter, Index = data.Count, Ident = "Check Radio", CheckText = "433", CompareObject = Frequency, CurrentValueText = "none", HasError = false, Result = null, RegisterIdent = "SENSUSRADIO_FrequencyIndicator" }); ;
data.Add(new PickingResultRegisterData { ReadMeter = meter, Index = data.Count, Ident = "Check Radio", CheckText = "433", CompareObject = Frequency, CurrentValueText = "none", HasError = false, Result = null, RegisterIdent = "SENSUSRADIO_FrequencyIndicator" }); ;
data.Add(new PickingResultRegisterData() { ReadMeter = meter, Index = data.Count, Ident = "MeterSize", CheckText = "DN40-50", CompareObject = MeterSize, CurrentValueText = "none", HasError = false, Result = null, RegisterIdent = "GENESISFLOW_MeterSize" });
data.Add(new PickingResultRegisterData { ReadMeter = meter, Index = data.Count, Ident = "MeterSize", CheckText = "DN40-50", CompareObject = MeterSize, CurrentValueText = "none", HasError = false, Result = null, RegisterIdent = "GENESISFLOW_MeterSize" });
}
foreach (var item in checkAppsIdVersion)
{
data.Add(new PickingResultCustomCheckData(delegate ()
{
data.Add(new PickingResultCustomCheckData(delegate
{
try
{
var MeterFWApp = meter.MeterAppListVersion.First(a => item.Key == a.AppId);
if (MeterFWApp == null || MeterFWApp.Version != item.Value)
{
return new PickingItemCheckReturn() { Result = false, Msg = MeterFWApp.StrVersion };
return new PickingItemCheckReturn { Result = false, Msg = MeterFWApp.StrVersion };
}
return new PickingItemCheckReturn() { Result = true, Msg = MeterFWApp.StrVersion };
return new PickingItemCheckReturn { Result = true, Msg = MeterFWApp.StrVersion };
}
catch (Exception)
{
return new PickingItemCheckReturn() { Result = false, Msg = "error" };
return new PickingItemCheckReturn { Result = false, Msg = "error" };
}
})
@@ -136,7 +133,7 @@ namespace ProductionUiCordonel.Model
}
data.Add(new PickingResultCustomCheckData(delegate ()
data.Add(new PickingResultCustomCheckData(delegate
{
try
{
@@ -145,19 +142,19 @@ namespace ProductionUiCordonel.Model
var storeRet = meter.ReadRegister("METROLOGYASST_StoreConfiguration");
if (storeRet.All(a => a.Equals(0)))
{
return new PickingItemCheckReturn() { Result = true, Msg = "Filesystem OK" };
return new PickingItemCheckReturn { Result = true, Msg = "Filesystem OK" };
}
return new PickingItemCheckReturn() { Result = false, Msg = "Filesystem corrupt" };
return new PickingItemCheckReturn { Result = false, Msg = "Filesystem corrupt" };
}
catch (Exception)
{
return new PickingItemCheckReturn() { Result = false, Msg = "error" };
return new PickingItemCheckReturn { Result = false, Msg = "error" };
}
})
{ Index = data.Count, Ident = $"Check Filesystem", CheckText = $"Check Filesystem", HasError = false, Result = null, CurrentValueText = "checking" }); ;
{ Index = data.Count, Ident = "Check Filesystem", CheckText = "Check Filesystem", HasError = false, Result = null, CurrentValueText = "checking" }); ;
Status = OverallStatus.CheckingIsRunning;
ChangeDataData(data);
@@ -168,7 +165,7 @@ namespace ProductionUiCordonel.Model
OnDataChanged?.Invoke(Data, EventArgs.Empty);
}
public bool Run(string pcbID, String OrderNr)
public Boolean Run(String pcbID, String OrderNr)
{
var tmpData = Data.ToList();
foreach (var item in tmpData.Where(a => !a.Result.HasValue).OrderBy(a => a.Index))
@@ -181,7 +178,7 @@ namespace ProductionUiCordonel.Model
if (tmpData.All(a => !a.HasError && a.Result.HasValue && a.Result.Value))
{
currentMeter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingTested);
currentMeter.SetProcessState(DisplayCodes.PickingTested);
var url = $"{ServiceUrls.MeterProcessStateUrl()}SetPickingState?PcbID={pcbID}&FertigungsauftragsNr={OrderNr}";
var RetString = LocalWebRequest.PostRequestAsyncAndGetContent(url);
@@ -198,21 +195,19 @@ namespace ProductionUiCordonel.Model
return false;
}
currentMeter.SetProcessState(DisplayCodes.PickingFailed);
if (tmpData.All(a => a.HasError))
{
Status = OverallStatus.CheckingIsHasError;
}
else
{
currentMeter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingFailed);
if (tmpData.All(a => a.HasError))
{
Status = OverallStatus.CheckingIsHasError;
}
else
{
Status = OverallStatus.CheckingIsNoMatch;
}
return false;
Status = OverallStatus.CheckingIsNoMatch;
}
return false;
}
@@ -1,12 +1,14 @@
using Newtonsoft.Json;
using ProductionUiCordonel.Data;
using ProductionUiCordonel.Event;
using System;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using Newtonsoft.Json;
using ProductionUiCordonel.Data;
using ProductionUiCordonel.Event;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
using Xylem.Common.Logic.ProductionOrderCore.ProcessState;
using Xylem.Common.Logic.ProductionOrderCore.TestResults;
using Xylem.Common.Logic.SoftwareAccessHelper;
@@ -21,37 +23,37 @@ namespace ProductionUiCordonel.Model
private PressureResultDataNotifyable result = new PressureResultDataNotifyable();
public PressureResultDataNotifyable Result
{
get { return result; }
get => result;
set
{
result = value;
NotifyPropertyChanged(nameof(Result));
NotifyPropertyChanged();
}
}
private bool inputIsEnabled = false;
public bool InputIsEnabled
private Boolean inputIsEnabled;
public Boolean InputIsEnabled
{
get { return inputIsEnabled; }
get => inputIsEnabled;
set
{
inputIsEnabled = value;
NotifyPropertyChanged(nameof(InputIsEnabled));
NotifyPropertyChanged();
}
}
public bool Locked { get; set; } = false;
public int? StationID { get; set; } = null;
public Boolean Locked { get; set; } = false;
public Int32? StationID { get; set; }
public PressureMultiModeViewModel(string ctrName, int slotNR, List<string> barcodeTrigger, int? stationID = null) : base(ctrName, slotNR, barcodeTrigger, stationID)
public PressureMultiModeViewModel(String ctrName, Int32 slotNR, List<String> barcodeTrigger, Int32? stationID = null) : base(ctrName, slotNR, barcodeTrigger, stationID)
{
base.VisibilityPressure = System.Windows.Visibility.Visible;
VisibilityPressure = Visibility.Visible;
StationID = stationID;
}
public bool isHydraulicStaion()
public Boolean isHydraulicStaion()
{
if (!StationID.HasValue || StationID.Value == 1)
@@ -60,12 +62,12 @@ namespace ProductionUiCordonel.Model
}
return true;
}
public override bool SlotIsLocked()
public override Boolean SlotIsLocked()
{
return false;
}
internal void ReloadData(bool reset)
internal void ReloadData(Boolean reset)
{
if (Result != null && Result.PcbId != CurrentPcbID)
@@ -75,7 +77,7 @@ namespace ProductionUiCordonel.Model
{
}
Result = new PressureResultDataNotifyable() { Remark = "loading", Testpoints = new ObservableCollection<PressureTestPoints>(), PcbId = "" };
Result = new PressureResultDataNotifyable { Remark = "loading", Testpoints = new ObservableCollection<PressureTestPoints>(), PcbId = "" };
Task<PressureResultDataNotifyable>.Run(() =>
{
try
@@ -98,7 +100,7 @@ namespace ProductionUiCordonel.Model
return new PressureResultDataNotifyable();
}
}).ContinueWith((a) =>
}).ContinueWith(a =>
{
var res = a.Result;
res.PcbId = CurrentPcbID;
@@ -112,14 +114,14 @@ namespace ProductionUiCordonel.Model
}
}
internal void StoreData(bool successfull)
internal void StoreData(Boolean successfull)
{
if (Result != null && Result.PcbId == CurrentPcbID)
{
InputIsEnabled = false;
var isStored = false;
var status = Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PressureTestedFailed;
var status = DisplayCodes.PressureTestedFailed;
Task.Run(() =>
{
@@ -127,13 +129,13 @@ namespace ProductionUiCordonel.Model
if (successfull)
{
status = Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PressureTested;
status = DisplayCodes.PressureTested;
}
try
{
if (StationID == 1)
{
var addResult = new PressureTestResult()
var addResult = new PressureTestResult
{
FreeText = Result.Remark,
Passed = successfull,
@@ -145,19 +147,19 @@ namespace ProductionUiCordonel.Model
if (!LocalWebRequest.PostRequestAsync(url, json: addResult))
{
throw new ApplicationException($"PressureState: NOT successful");
throw new ApplicationException("PressureState: NOT successful");
}
}
else
{
url = url + $"SetPressureStateDetailed";
url = url + "SetPressureStateDetailed";
var mutedResult = Result.ToBase();
isStored = LocalWebRequest.PostRequestAsync(url, json: mutedResult);
if (!isStored)
{
OnStoreDone?.Invoke(null, new StringArgs("Can not store Result"));
status = Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PressureTestedFailed;
status = DisplayCodes.PressureTestedFailed;
}
}
@@ -168,12 +170,12 @@ namespace ProductionUiCordonel.Model
catch (Exception ex)
{
Log(ex.Message);
status = Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PressureTestedFailed;
status = DisplayCodes.PressureTestedFailed;
OnStoreDone?.Invoke(null, new StringArgs("Can not store Result"));
}
if (status == Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PressureTested)
if (status == DisplayCodes.PressureTested)
{
OnStoreDone?.Invoke(null, new StringArgs("Pressure test stored successfully. Meter can passed"));
return;
+8 -11
View File
@@ -1,13 +1,10 @@
using ProductionUiCordonel.Model;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Interop;
using ProductionUiCordonel.Model;
namespace ProductionUiCordonel
{
@@ -49,9 +46,9 @@ namespace ProductionUiCordonel
DataContext = multiModeMasterViewModel;
InitializeComponent();
this.Topmost = false;
Topmost = false;
}
private void keyUp(object sender, KeyEventArgs e)
private void keyUp(Object sender, KeyEventArgs e)
{
}
@@ -76,7 +73,7 @@ namespace ProductionUiCordonel
}
CancellationTokenSource cts;
private void Window_Loaded(object sender, RoutedEventArgs e)
private void Window_Loaded(Object sender, RoutedEventArgs e)
{
cts = new CancellationTokenSource();
AppSettings = new ApplicationSettings("MultiProductionUiConfig.json");
@@ -164,12 +161,12 @@ namespace ProductionUiCordonel
//SetBaseFocus();
}
private void delegeChild_PosChange(object sender, EventArgs e)
private void delegeChild_PosChange(Object sender, EventArgs e)
{
throw new NotImplementedException();
}
private void TxtBarcodeInput_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
private void TxtBarcodeInput_TextChanged(Object sender, TextChangedEventArgs e)
{
//if (sender is TextBox text)
//{
@@ -192,7 +189,7 @@ namespace ProductionUiCordonel
}
private void Window_Closed(object sender, System.EventArgs e)
private void Window_Closed(Object sender, EventArgs e)
{
cts.Cancel();
@@ -1,11 +1,12 @@
using ProductionUiCordonel.Model;
using System;
using System;
using System.IO.Ports;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Threading;
using ProductionUiCordonel.Event;
using ProductionUiCordonel.Model;
namespace ProductionUiCordonel
{
@@ -16,7 +17,7 @@ namespace ProductionUiCordonel
{
public IMultiModeChildViewModel ViewModel;
public bool UseDefaultPos { get; internal set; } = true;
public Boolean UseDefaultPos { get; internal set; } = true;
public event EventHandler PosChanged;
@@ -24,38 +25,38 @@ namespace ProductionUiCordonel
{
InitializeComponent();
ViewModel = viewModel;
this.DataContext = ViewModel;
DataContext = ViewModel;
if (ViewModel is PressureMultiModeViewModel pressureModel)
{
PressureControl.setViewModel(pressureModel);
this.Left = 0;
this.Top = 250;
this.Height = SystemParameters.PrimaryScreenHeight - 300;
this.Width = SystemParameters.PrimaryScreenWidth / 2;
Left = 0;
Top = 250;
Height = SystemParameters.PrimaryScreenHeight - 300;
Width = SystemParameters.PrimaryScreenWidth / 2;
}
if (ViewModel is PickingMultiModeViewModel pickingModel)
{
PickingControl.setViewModel(pickingModel);
this.Left = SystemParameters.VirtualScreenLeft;
this.Top = SystemParameters.VirtualScreenTop;
this.Height = SystemParameters.VirtualScreenHeight;
this.Width = SystemParameters.VirtualScreenWidth - SystemParameters.PrimaryScreenWidth;
Left = SystemParameters.VirtualScreenLeft;
Top = SystemParameters.VirtualScreenTop;
Height = SystemParameters.VirtualScreenHeight;
Width = SystemParameters.VirtualScreenWidth - SystemParameters.PrimaryScreenWidth;
}
if (ViewModel is MarriageMultiModeViewModel marriageModel)
{
MarriageControl.setViewModel(marriageModel);
this.Left = SystemParameters.PrimaryScreenWidth / 2;
this.Top = 250;
this.Height = SystemParameters.PrimaryScreenHeight - 300;
this.Width = SystemParameters.PrimaryScreenWidth / 2;
Left = SystemParameters.PrimaryScreenWidth / 2;
Top = 250;
Height = SystemParameters.PrimaryScreenHeight - 300;
Width = SystemParameters.PrimaryScreenWidth / 2;
}
}
internal void StartTextInputListener(string port, CancellationToken cancellation)
internal void StartTextInputListener(String port, CancellationToken cancellation)
{
if (port == null)
{
@@ -72,17 +73,14 @@ namespace ProductionUiCordonel
{
break;
}
else
{
var resText = a.ReadLine();
this.Dispatcher.Invoke(DispatcherPriority.Normal,
var resText = a.ReadLine();
Dispatcher.Invoke(DispatcherPriority.Normal,
new Action(() =>
{
ViewModel.InputText(resText);
}
{
ViewModel.InputText(resText);
}
));
}
@@ -95,22 +93,22 @@ namespace ProductionUiCordonel
}
internal void InputText(string text)
internal void InputText(String text)
{
ViewModel.InputText(text);
}
private void BtnPresueFailed_Click(object sender, RoutedEventArgs e)
private void BtnPresueFailed_Click(Object sender, RoutedEventArgs e)
{
}
private void TxtPresurePcbId_TextChanged(object sender, TextChangedEventArgs e)
private void TxtPresurePcbId_TextChanged(Object sender, TextChangedEventArgs e)
{
}
private void PressureControl_OnBarcodeInput(object sender, Event.StringArgs e)
private void PressureControl_OnBarcodeInput(Object sender, StringArgs e)
{
InputText(e.Content);
}
@@ -121,15 +119,15 @@ namespace ProductionUiCordonel
}
private void Button_Click(object sender, RoutedEventArgs e)
private void Button_Click(Object sender, RoutedEventArgs e)
{
if (sender is Button btn)
{
btn.Content = $"POS L{this.Left},T{this.Top },H{this.Height},W{this.Width}";
btn.Content = $"POS L{Left},T{Top },H{Height},W{Width}";
}
}
private void Button_Click_1(object sender, RoutedEventArgs e)
private void Button_Click_1(Object sender, RoutedEventArgs e)
{
PosChanged?.Invoke(this, EventArgs.Empty);
}
@@ -1,9 +1,10 @@
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using System;
using System;
using System.Linq;
using System.Windows.Controls;
using System.Windows.Threading;
using Newtonsoft.Json;
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Logic.SoftwareAccessHelper;
@@ -28,7 +29,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -42,26 +43,25 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
private void doStartProcessLoop()
{
var reTrysLeft = 1;
while (reTrysLeft >= 0)
var retriesRemaining = 1;
while (retriesRemaining >= 0)
{
try
{
base.Progress = 0;
Progress = 0;
//var url = $"http://localhost:56011/api/FinalCheck/GetProgrammingParameters?PcbID={Meter.PcbId}";
var url = $"{ServiceUrls.MeterInfoForTestBench()}{Meter.PcbId}";
var csdRet = LocalWebRequest.GetRequest(url);
var res = Newtonsoft.Json.JsonConvert.DeserializeObject<string[]>(csdRet);
var res = JsonConvert.DeserializeObject<String[]>(csdRet);
var CalibrationRun = res[4];
var LastTestBechState = 0;
bool? HyState = null;
bool? preState = null;
Boolean? HyState;
Boolean? preState = null;
if (!string.IsNullOrEmpty(res[5]))
{
var tmp = 0;
int.TryParse(res[5], out tmp);
int.TryParse(res[5], out var tmp);
LastTestBechState = tmp;
}
@@ -89,24 +89,24 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
UserControl.lblText.Dispatcher.Invoke(DispatcherPriority.Send,
new Action(() =>
{
UserControl.lblText.Content = $"Zähler nicht erfolgreich geprüft";
UserControl.lblText.Content = "Zähler nicht erfolgreich geprüft";
}
));
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
if (!preState.HasValue || !preState.Value)
{
UserControl.lblText.Dispatcher.Invoke(DispatcherPriority.Send,
new Action(() =>
{
UserControl.lblText.Content = $"Zähler nicht erfolgreich vorbehandelt";
UserControl.lblText.Content = "Zähler nicht erfolgreich vorbehandelt";
}
));
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
base.Progress = 50;
Progress = 50;
var nowSeconds = Meter.ReadRegister("POWERMON_TotalUsedSeconds");
var nowCharge = Meter.ReadRegister("POWERMON_TotalUsedCharge", 8);
@@ -116,10 +116,10 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
UserControl.lblText.Dispatcher.Invoke(DispatcherPriority.Send,
new Action(() =>
{
UserControl.lblText.Content = $"Batterie nicht lesbar";
UserControl.lblText.Content = "Batterie nicht lesbar";
}
));
Meter.WriteLog($"Batterie nicht lesbar");
Meter.WriteLog("Batterie nicht lesbar");
break;
}
var nowChargeV = BitConverter.ToUInt64(nowCharge.ToArray(), 0);
@@ -129,8 +129,9 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
//// Time Span in h in mAhr In % with one battery is 100%
////(((total used change difference / (Time span / 3600) ) / 3600000) / 19000)*100
var loadAtH = ((((double)nowChargeV / ((double)nowSecondsV / 3600)) / 3600000) / (19000 * 2)) * 100;
var totalUsed = (((double)nowChargeV / 1000000 / 3.6) / ((19000 * 2))) * 100;
// ReSharper disable once UnusedVariable used for debug purposes
var loadAtH = nowChargeV / ((Double)nowSecondsV / 3600) / 3600000 / (19000 * 2) * 100;
var totalUsed = (Double)nowChargeV / 1000000 / 3.6 / (19000 * 2) * 100;
//lastFrame
Meter.WriteLog($"totalUsed at EOL {totalUsed}");
@@ -138,9 +139,9 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
if (totalUsed > 10)
{
base.currentProcessState = ProductionProcessState.Error;
UserControl.lblText.Content = $"Batterie über 15% entladen";
Meter.WriteLog($"Batterie über 15% entladen");
currentProcessState = ProductionProcessState.Error;
UserControl.lblText.Content = "Batterie über 15% entladen";
Meter.WriteLog("Batterie über 15% entladen");
}
if (currentProcessState != ProductionProcessState.Error)
@@ -148,20 +149,20 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
currentProcessState = ProductionProcessState.Done;
return;
}
reTrysLeft = reTrysLeft - 1;
retriesRemaining = retriesRemaining - 1;
currentProcessState = ProductionProcessState.Error;
}
catch (Exception ex)
{
Meter.WriteLog($"{ex}");
base.currentProcessState = ProductionProcessState.Error;
reTrysLeft = reTrysLeft - 1;
currentProcessState = ProductionProcessState.Error;
retriesRemaining = retriesRemaining - 1;
}
}
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
public override void StartProcess()
@@ -1,17 +1,12 @@
using ProductionUiCordonel.ProductionProcesses.Enum;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using Newtonsoft.Json;
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using System.Threading;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Logic.SoftwareAccessHelper;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Logic.ProductionOrderCore.Vako;
using Xylem.Common.Logic.SoftwareAccessHelper;
namespace ProductionUiCordonel.ProductionProcesses.Actions
{
@@ -25,9 +20,9 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
Error,
Acknowledge
}
public bool DialogIsDone { get; private set; }
public int OrderNumber { get; set; }
public ProductionProcessCheckAttachment(int orderNumber)
public Boolean DialogIsDone { get; }
public Int32 OrderNumber { get; set; }
public ProductionProcessCheckAttachment(Int32 orderNumber)
{
OrderNumber = orderNumber;
DialogIsDone = false;
@@ -43,7 +38,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -56,23 +51,23 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
private void StepDone()
{
base.currentProcessState = ProductionProcessState.Done;
currentProcessState = ProductionProcessState.Done;
isDone?.Invoke(null, EventArgs.Empty);
}
private void StepError()
{
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
isDone?.Invoke(null, EventArgs.Empty);
}
public override async void StartProcess()
public override void StartProcess()
{
try
{
var a = LocalWebRequest.GetRequest($"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetSingleVakoKey?ProductionOrderNumber={OrderNumber}&KeyName=C_GEN_PULS");
var myJsonResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<VakoKeyValue>(a);
var myJsonResponse = JsonConvert.DeserializeObject<VakoKeyValue>(a);
if (myJsonResponse.Value.ToLower() == "q" || myJsonResponse.Value.ToLower() == "k")
{
UserControl.SetDesc("Pulse Module anbauen!");
@@ -1,17 +1,10 @@
using ProductionUiCordonel.ProductionProcesses.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using ProductionUiCordonel.UserControls.FinalTest;
using System.Threading;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using System;
using System.IO;
using System.Net;
using System.Windows.Controls;
using Newtonsoft.Json;
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using Xylem.Common.CommonCore.Configuration;
namespace ProductionUiCordonel.ProductionProcesses.Actions
@@ -28,14 +21,13 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
Print,
Abort
}
public bool DialogIsDone { get; private set; }
public int SerialNumber { get; private set; }
public int Ordernumber { get; private set; }
public Boolean DialogIsDone { get; }
public Int32 SerialNumber { get; private set; }
public Int32 Ordernumber { get; private set; }
private int? OldOrderNumber { get; set; }
private bool Error = false;
public ProductionProcessCheckOrderNumber(int? oldOrderNumber = null)
private Int32? OldOrderNumber { get; }
public ProductionProcessCheckOrderNumber(Int32? oldOrderNumber = null)
{
OldOrderNumber = oldOrderNumber;
@@ -53,7 +45,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -66,23 +58,23 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
private void StepDone()
{
base.currentProcessState = ProductionProcessState.Done;
currentProcessState = ProductionProcessState.Done;
isDone?.Invoke(this, EventArgs.Empty);
}
private void StepMismatch(string msg)
private void StepMismatch(String msg)
{
UserControl.SetDesc(msg);
UserControl.SetFocusMe();
//UserControl.Focus();
base.NewStatus(msg);
NewStatus(msg);
UserControl.BarcodeInput += UserControl_KeyDown;
}
private void UserControl_KeyDown(object sender, string input)
private void UserControl_KeyDown(Object sender, String input)
{
var a = input;
@@ -101,7 +93,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
//StepDone();
}
public override async void StartProcess()
public override void StartProcess()
{
//get order number
@@ -120,7 +112,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
}
private void GetPcbMapping(string pcbID)
private void GetPcbMapping(String pcbID)
{
if (string.IsNullOrEmpty(pcbID))
{
@@ -132,7 +124,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
try
{
var http = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = null;
HttpWebResponse response;
try
{
response = (HttpWebResponse)http.GetResponse();
@@ -145,15 +137,16 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
if (response != null && response.StatusCode == HttpStatusCode.OK)
{
var responseStream = response.GetResponseStream();
using (var sr = new StreamReader(responseStream))
{
var responseJson = sr.ReadToEnd();
var a = JsonConvert.DeserializeObject<string[]>(responseJson);
SerialNumber = Convert.ToInt32(a[0]);
Ordernumber = Convert.ToInt32(a[1]);
if (responseStream != null)
using (var sr = new StreamReader(responseStream))
{
var responseJson = sr.ReadToEnd();
var a = JsonConvert.DeserializeObject<String[]>(responseJson);
SerialNumber = Convert.ToInt32(a[0]);
Ordernumber = Convert.ToInt32(a[1]);
Meter.SerialNumber = SerialNumber.ToString();
}
Meter.SerialNumber = SerialNumber.ToString();
}
}
else
{
@@ -1,18 +1,7 @@
using ProductionUiCordonel.ProductionProcesses.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System;
using System.Windows.Controls;
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using System.Threading;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using System.IO;
using System.Net;
using Newtonsoft.Json;
using Xylem.Common.CommonCore.Configuration;
namespace ProductionUiCordonel.ProductionProcesses.Actions
{
@@ -28,13 +17,12 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
Print,
Abort
}
public bool DialogIsDone { get; private set; }
public string PcbSerialNumber { get; private set; }
public Boolean DialogIsDone { get; }
public String PcbSerialNumber { get; private set; }
public string AltRadio { get; private set; }
public String AltRadio { get; }
private bool Error = false;
public ProductionProcessCheckSerialNumber(String pcbSerialNumber, string altRadio = null)
public ProductionProcessCheckSerialNumber(String pcbSerialNumber, String altRadio = null)
{
PcbSerialNumber = pcbSerialNumber;
@@ -52,7 +40,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -65,21 +53,21 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
private void StepDone()
{
base.currentProcessState = ProductionProcessState.Done;
currentProcessState = ProductionProcessState.Done;
isDone?.Invoke(this, EventArgs.Empty);
}
private void StepMismatch(string msg)
private void StepMismatch(String msg)
{
base.currentProcessState = ProductionProcessState.Error;
base.NewStatus(msg);
currentProcessState = ProductionProcessState.Error;
NewStatus(msg);
isDone?.Invoke(this, EventArgs.Empty);
}
private void UserControl_KeyDown(object sender, string input)
private void UserControl_KeyDown(Object sender, String input)
{
var a = input;
PcbSerialNumber = Meter.SerialNumber;
@@ -114,7 +102,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
//StepDone();
}
public override async void StartProcess()
public override void StartProcess()
{
PcbSerialNumber = Meter.SerialNumber;
UserControl.SetDesc($"Bitte den Deckel des Zählers Scannern{Environment.NewLine} Die Seriennummer muss abgeglichen werden.");
@@ -1,9 +1,10 @@
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using System;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Windows.Controls;
using Newtonsoft.Json;
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Logic.ProductionOrderCore;
@@ -13,27 +14,34 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
public class ProductionProcessConnect : BaseProductionProcess
{
public Task<IList<ProgrammingParameters>> asyncprogrammingParametersTask;
public Task<IList<ProgrammingParameters>> asyncProgrammingParametersTask;
private UcPlain UserControl;
private GenesisMeter Meter;
public ProductionProcessConnect()
public ProductionProcessConnect(GenesisMeter meter)
{
Meter = meter;
name = "Connect";
currentProcessState = ProductionProcessState.Waiting;
}
public override void InitUserControl()
{
UserControl = new UcPlain();
UserControl.lblHl.Content = name;
UserControl.lblText.Content = "";
UserControl = new UcPlain
{
lblHl =
{
Content = name
},
lblText =
{
Content = ""
}
};
}
public override UserControl GetControl()
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -46,49 +54,47 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
public override void StartProcess()
{
base.NewStatus($"Prüfe Verbindung");
base.Progress = 0;
if (!base.Meter.IsLoggedOn)
NewStatus("Prüfe Verbindung");
Progress = 0;
if (!Meter.IsLoggedOn)
{
base.NewStatus($"Login wird gestartet");
base.Meter.Login();
NewStatus("Login wird gestartet");
Meter.Login();
}
//Check access in
base.Progress = 50;
base.NewStatus($"Zugang wird überprüft");
Progress = 50;
NewStatus("Zugang wird überprüft");
//var res = base.Meter.ReadRegister(Register.Genesisflow.LedMode);
//if (res != null && res.Length > 0)
//{
base.Progress = 100;
base.NewStatus($"Zugang verifiziert");
Progress = 100;
NewStatus("Zugang verifiziert");
currentProcessState = ProductionProcessState.Done;
asyncprogrammingParametersTask = new Task<IList<ProgrammingParameters>>(() =>
asyncProgrammingParametersTask = new Task<IList<ProgrammingParameters>>(() =>
{
try
{
//var url = $"http://localhost:56011/api/FinalCheck/GetProgrammingParameters?PcbID={base.Meter.PcbId}";
var url = $"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetProgrammingParameters?PcbID={base.Meter.PcbId}";
var url = $"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetProgrammingParameters?PcbID={Meter.PcbId}";
var csdRet = LocalWebRequest.GetRequest(url, 80000);
return Newtonsoft.Json.JsonConvert.DeserializeObject<IList<ProgrammingParameters>>(csdRet);
return JsonConvert.DeserializeObject<IList<ProgrammingParameters>>(csdRet);
}
catch (Exception ex)
catch (Exception )
{
return new List<ProgrammingParameters>() { };
return new List<ProgrammingParameters>
{
Capacity = 0
};
}
});
asyncprogrammingParametersTask.Start();
asyncProgrammingParametersTask.Start();
return;
//}
currentProcessState = ProductionProcessState.Error;
// throw new Exception($"Not able to login");
}
}
}
@@ -1,20 +1,14 @@
using ProductionUiCordonel.ProductionProcesses.Enum;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using System.Threading;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
namespace ProductionUiCordonel.ProductionProcesses.Actions
{
public class ProductionProcessDone : BaseProductionProcess
{
public event EventHandler<Tuple<bool,bool, bool>> isDone;
public event EventHandler<Tuple<Boolean,Boolean, Boolean>> isDone;
private UcDialog UserControl;
public DialogResult Result = DialogResult.None;
public enum DialogResult
@@ -24,9 +18,9 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
Print,
Abort
}
public bool DialogIsDone { get; private set; }
private bool Error = false;
public ProductionProcessDone(bool error = false)
public Boolean DialogIsDone { get; }
private Boolean Error;
public ProductionProcessDone(Boolean error = false)
{
Error = error;
DialogIsDone = false;
@@ -42,7 +36,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -55,7 +49,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
private void StepDone()
{
base.currentProcessState = ProductionProcessState.Done;
currentProcessState = ProductionProcessState.Done;
var retry = false;
var abort = false;
var print = false;
@@ -74,14 +68,12 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
case DialogResult.Abort:
abort = true;
break;
default:
break;
}
}
isDone?.Invoke(null, new Tuple<bool, bool,bool>(retry, abort, print));
isDone?.Invoke(null, new Tuple<Boolean, Boolean,Boolean>(retry, abort, print));
}
private void StepError(string ErrorText = "Ein Fehler ist aufgetreten")
private void StepError(String ErrorText = "Ein Fehler ist aufgetreten")
{
UserControl.SetDesc(ErrorText);
@@ -132,7 +124,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
UserControl.SetDialogOptions(OptionList);
}
public override async void StartProcess()
public override void StartProcess()
{
if (Error)
{
@@ -1,25 +1,24 @@
using Newtonsoft.Json;
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Windows.Controls;
using Xylem.Common.CommonCore.Configuration;
using Newtonsoft.Json;
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
namespace ProductionUiCordonel.ProductionProcesses.Actions
{
public class ProductionProcessFinalParameterizationFix : BaseProductionProcess
public class ProductionProcessFinalParametrizationFix : BaseProductionProcess
{
private UcPlain UserControl;
public ProductionProcessFinalParameterizationFix()
public ProductionProcessFinalParametrizationFix()
{
name = "Final Parameterization";
name = "Final Parametrization";
currentProcessState = ProductionProcessState.Waiting;
}
public override void InitUserControl()
@@ -31,7 +30,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -59,7 +58,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
public Task<Tuple<String, Boolean>> wirteRegisterInBetweenCheck(String reg, Int32 value, Boolean waitForResult = true,
Boolean checkRegister = false, int addToCheck = 10, int addFromCheck = 0)
Boolean checkRegister = false, Int32 addToCheck = 10, Int32 addFromCheck = 0)
{
return new Task<Tuple<String, Boolean>>(() =>
{
@@ -77,21 +76,12 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
public override void StartProcess()
{
Progress = 0;
base.Progress = 0;
var useRadio = true;
var radioParams = new RadioConfigurationParams();
if (useRadio)
RadioConfigurationParams radioParams;
{
var url = ServiceUrls.GenesisFinalCheckServiceUrl();
url = "http://localhost:56011/api/FinalCheck/";
url = url + $"GetRadioConfiguration?PcbId={Meter.PcbId}&withPressure=false";
var url = "http://localhost:56011/api/FinalCheck/";
url += $"GetRadioConfiguration?PcbId={Meter.PcbId}&withPressure=false";
var http = (HttpWebRequest)WebRequest.Create(url);
http.Method = "GET";
@@ -108,7 +98,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
radioParams = JsonConvert.DeserializeObject<RadioConfigurationParams>(responseJson);
}
}
base.Progress = 20;
Progress = 20;
@@ -169,11 +159,8 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
(new Byte[] { 0x00, 0x00, 0x00, 0xFD }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_DisplayUnits",
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
if (useRadio)
{
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_ForwardArrow",
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
}
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_ForwardArrow",
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_HardErrorLimit",
(new Byte[] { 0x00, 0x00, 0x00, 0x04 }).Reverse().ToArray(), true, true));
@@ -189,7 +176,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_PipeFillingDelay",
(new Byte[] { 0x00, 0x00, 0x00, 0x1E }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_ResetAccumulators",
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, false));
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray()));
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_SampleRate",
(new Byte[] { 0x00, 0x00, 0x00, 0x02 }).Reverse().ToArray(), true, true));
@@ -226,26 +213,18 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
(new Byte[] { 0x00, 0x00, 0x27, 0x10 }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_TemperatureUnits",
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("POWERMON_BatterySelection",
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, false));
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray()));
overAllResult.Add(_currentGenesis_WriteRegister("POWERMON_WarnFromClamp",
(new Byte[] { 0x25, 0x89, 0x06, 0x00 }).Reverse().ToArray(), true, true));
//// just read later //overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_FrequencyIndicator}).Reverse(), true, true);
//Original
//0x11, 0x12, 0x13, 0x14, 0x21, 0x22, 0x23, 0x24, 0x31, 0x32, 0x33, 0x34, 0x41, 0x42, 0x43, 0x44
//Write to register
//0x14, 0x13, 0x12, 0x11, 0x24, 0x23, 0x22, 0x21, 0x34, 0x33, 0x32, 0x31, 0x44, 0x43, 0x42, 0x41
//good one
//E6-C8-88-00-DE-B8-68-C0-D6-A8-48-80-CE-98-28-40
//0E-05-04-04-00-14-30-68-D0-14-0E-80-40-63-93-73-22
@@ -253,85 +232,74 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
//&bad one
//0E-05-04-05-00-00-88-C8-E6-C0-68-B8-DE-80-48-A8-D6-40-28-98-CE
//0E-05-04-04-00-22-73-93-63-40-80-0E-14-D0-68-30-14
if (useRadio)
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_WakeupInterval",
(new Byte[] { 0x00, 0x00, 0x00, 0x03 }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_MbusState",
(new Byte[] { 0x00, 0x00, 0x00, 0x07 }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_UtcTimeOffset",
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_HistoricalAlarmsDays",
(new Byte[] { 0x00, 0x00, 0x00, 0x1D }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_AverageFlowPeriod",
(new Byte[] { 0x00, 0x00, 0x00, 0x05 }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_DataLogContents",
(new Byte[] { 0x0C, 0x00, 0x24, 0x03 }).Reverse().ToArray()));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_DataLogPeriod",
(new Byte[] { 0x00, 0x00, 0x00, 0x3C }).Reverse().ToArray()));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_FixedDateDayOfMonth",
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray()));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_FixedDateReadingContents",
(new Byte[] { 0x0C, 0x00, 0x24, 0x03 }).Reverse().ToArray()));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_PeriodicLogLifeTimeCounter",
(new Byte[] { 0x00, 0x00, 0x00, 0x0 }).Reverse().ToArray()));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_ResetCounter",
(new Byte[] { 0x00, 0x00, 0x00, 0x0 }).Reverse().ToArray(), true, true));
//var funkadresse = new List<byte>();
//funkadresse.AddRange((new Byte[] { 0xE6, 0xC8, 0x88, 0x00 }).ToArray());
//funkadresse.AddRange((new Byte[] { 0xDE, 0xB8, 0x68, 0xC0 }).ToArray());
//funkadresse.AddRange((new Byte[] { 0xD6, 0xA8, 0x48, 0x80 }).ToArray());
//funkadresse.AddRange((new Byte[] { 0xCE, 0x98, 0x28, 0x40 }).ToArray());
//overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_EncryptionKey", funkadresse.ToArray(),
// true, true));
//overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_EncryptionKey",
// (new Byte[]
// {
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
// }).ToArray(), true, true));
var funkadresse = new List<Byte>();
funkadresse.AddRange((new Byte[] { 0x0E, 0x9F, 0xAC, 0xC6 }).ToArray());
funkadresse.AddRange((new Byte[] { 0xA0, 0xE1, 0xEF, 0x1C }).ToArray());
funkadresse.AddRange((new Byte[] { 0x3B, 0x27, 0xA4, 0x9B }).ToArray());
funkadresse.AddRange((new Byte[] { 0xAC, 0x21, 0x65, 0x35 }).ToArray());
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_EncryptionKey", funkadresse.ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_RadioAddress", radioParams.RadioAddress, true, true));
if (radioParams.PowerLevel > 0 && radioParams.PowerLevelOption > 0 && radioParams.ImpedanceCodeNew > 0 && radioParams.ImpedanceCodeOption > 0)
{
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_PowerLevel", radioParams.PowerLevel, true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_PowerLevelOption", radioParams.PowerLevelOption, true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_ImpedanceCodeNew", radioParams.ImpedanceCodeNew, true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_ImpedanceCodeOption", radioParams.ImpedanceCodeOption, true, true));
}
else
{
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_WakeupInterval",
(new Byte[] { 0x00, 0x00, 0x00, 0x03 }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_MbusState",
(new Byte[] { 0x00, 0x00, 0x00, 0x07 }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_UtcTimeOffset",
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_HistoricalAlarmsDays",
(new Byte[] { 0x00, 0x00, 0x00, 0x1D }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_AverageFlowPeriod",
(new Byte[] { 0x00, 0x00, 0x00, 0x05 }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_DataLogContents",
(new Byte[] { 0x0C, 0x00, 0x24, 0x03 }).Reverse().ToArray(), true, false));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_DataLogPeriod",
(new Byte[] { 0x00, 0x00, 0x00, 0x3C }).Reverse().ToArray(), true, false));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_FixedDateDayOfMonth",
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, false));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_FixedDateReadingContents",
(new Byte[] { 0x0C, 0x00, 0x24, 0x03 }).Reverse().ToArray(), true, false));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_PeriodicLogLifeTimeCounter",
(new Byte[] { 0x00, 0x00, 0x00, 0x0 }).Reverse().ToArray(), true, false));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_ResetCounter",
(new Byte[] { 0x00, 0x00, 0x00, 0x0 }).Reverse().ToArray(), true, true));
//var funkadresse = new List<byte>();
//funkadresse.AddRange((new Byte[] { 0xE6, 0xC8, 0x88, 0x00 }).ToArray());
//funkadresse.AddRange((new Byte[] { 0xDE, 0xB8, 0x68, 0xC0 }).ToArray());
//funkadresse.AddRange((new Byte[] { 0xD6, 0xA8, 0x48, 0x80 }).ToArray());
//funkadresse.AddRange((new Byte[] { 0xCE, 0x98, 0x28, 0x40 }).ToArray());
//overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_EncryptionKey", funkadresse.ToArray(),
// true, true));
//overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_EncryptionKey",
// (new Byte[]
// {
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
// }).ToArray(), true, true));
var funkadresse = new List<byte>();
funkadresse.AddRange((new Byte[] { 0x0E, 0x9F, 0xAC, 0xC6 }).ToArray());
funkadresse.AddRange((new Byte[] { 0xA0, 0xE1, 0xEF, 0x1C }).ToArray());
funkadresse.AddRange((new Byte[] { 0x3B, 0x27, 0xA4, 0x9B }).ToArray());
funkadresse.AddRange((new Byte[] { 0xAC, 0x21, 0x65, 0x35 }).ToArray());
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_EncryptionKey", funkadresse.ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_RadioAddress", radioParams.RadioAddress, true, true));
if (radioParams.PowerLevel > 0 && radioParams.PowerLevelOption > 0 && radioParams.ImpedanceCodeNew > 0 && radioParams.ImpedanceCodeOption > 0)
{
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_PowerLevel", radioParams.PowerLevel, true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_PowerLevelOption", radioParams.PowerLevelOption, true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_ImpedanceCodeNew", radioParams.ImpedanceCodeNew, true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_ImpedanceCodeOption", radioParams.ImpedanceCodeOption, true, true));
}
else
{
base.currentProcessState = ProductionProcessState.Error;
return;
}
//_currentGenesis_WriteRegister("SENSUSRADIO_CustomerText",
// (new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, false);
currentProcessState = ProductionProcessState.Error;
return;
}
//_currentGenesis_WriteRegister("SENSUSRADIO_CustomerText",
// (new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, false);
var ts = DateTimeOffset.UtcNow - new DateTimeOffset(2000, 1, 1, 0, 0, 0, new TimeSpan(0));
overAllResult.Add(wirteRegisterInBetweenCheck("SYSTEM_CalendarSeconds", Convert.ToInt32(ts.TotalSeconds)));
@@ -349,30 +317,30 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
var ret = true;
int done = 0;
Int32 done = 0;
foreach (var cTask in overAllResult)
{
cTask.RunSynchronously();
if (cTask.Result.Item2)
{
base.NewStatus($"set Parameter {cTask.Result.Item1} succeed");
NewStatus($"set Parameter {cTask.Result.Item1} succeed");
}
else
{
base.NewStatus($"set Parameter {cTask.Result.Item1} failed");
NewStatus($"set Parameter {cTask.Result.Item1} failed");
ret = false;
break;
}
base.Progress = 20 + ((Int32)Math.Round(((Double)done / (Double)overAllResult.Count) * 80, 0));
done = done + 1;
Progress = 20 + ((Int32)Math.Round((done / (Double)overAllResult.Count) * 80, 0));
done += 1;
}
if (!ret)
{
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
else
{
@@ -1,23 +1,23 @@
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Controls;
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Logic.ProductionOrderCore;
namespace ProductionUiCordonel.ProductionProcesses.Actions
{
public class ProductionProcessFinalParameterizationVakoCsd : BaseProductionProcess
public class ProductionProcessFinalParametrizationVakoCsd : BaseProductionProcess
{
private UcPlain UserControl;
private ProductionProcessConnect connectProcess;
private bool hasRadio;
private Boolean hasRadio;
public ProductionProcessFinalParameterizationVakoCsd(ProductionProcessConnect connectProcess, bool registerHasRadio = true)
public ProductionProcessFinalParametrizationVakoCsd(ProductionProcessConnect connectProcess, Boolean registerHasRadio = true)
{
this.connectProcess = connectProcess;
name = "Kunden Parametrierung";
@@ -27,16 +27,24 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
public override void InitUserControl()
{
UserControl = new UcPlain();
UserControl.lblHl.Content = name;
UserControl.lblText.Content = "Kann bis zu 1 Minute dauern!";
UserControl = new UcPlain
{
lblHl =
{
Content = name
},
lblText =
{
Content = "Dieser Vorgang kann bis zu 1 Minute dauern!"
}
};
}
public override UserControl GetControl()
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -52,8 +60,6 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
return new Task<Tuple<String, Boolean>>(() =>
{
Task.Delay(10).Wait();
var ret = Meter.WriteRegister(reg, value, waitForResult, checkRegister);
if (!ret)
@@ -65,15 +71,15 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
}
public Task<Tuple<String, Boolean>> wirteRegisterInBetweenCheck(String reg, Int32 value, Boolean waitForResult = true,
Boolean checkRegister = false, int addToCheck = 10, int addFromCheck = 0)
public Task<Tuple<String, Boolean>> wirteRegisterInBetweenCheck(String reg, Int32 value, Boolean waitForResult = true,
Int32 addToCheck = 10, Int32 addFromCheck = 0)
{
return new Task<Tuple<String, Boolean>>(() =>
{
Meter.WriteRegister(reg, value, waitForResult);
var accucalValue = RegisterConverter.ConvertTo<Int32>(Meter.ReadRegister(reg));
if (accucalValue >= (value + addFromCheck) && value <= accucalValue + (addToCheck))
var actualValue = RegisterConverter.ConvertTo<Int32>(Meter.ReadRegister(reg));
if (actualValue >= (value + addFromCheck) && value <= actualValue + (addToCheck))
{
return new Tuple<String, Boolean>(reg, true);
}
@@ -83,23 +89,23 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
private void doStartProcessLoop()
{
var reTrysLeft = 4;
while (reTrysLeft >= 0)
var remainingRetries = 4;
while (remainingRetries >= 0)
{
try
{
while (connectProcess.asyncprogrammingParametersTask.Status == TaskStatus.Running)
while (connectProcess.asyncProgrammingParametersTask.Status == TaskStatus.Running)
{
Thread.Sleep(500);
}
if (connectProcess.asyncprogrammingParametersTask.Status == TaskStatus.RanToCompletion
&& connectProcess.asyncprogrammingParametersTask.Result != null
&& connectProcess.asyncprogrammingParametersTask.Result.Any())
if (connectProcess.asyncProgrammingParametersTask.Status == TaskStatus.RanToCompletion
&& connectProcess.asyncProgrammingParametersTask.Result != null
&& connectProcess.asyncProgrammingParametersTask.Result.Any())
{
var myJsonResponse = connectProcess.asyncprogrammingParametersTask.Result;
var myJsonResponse = connectProcess.asyncProgrammingParametersTask.Result;
base.Progress = 15;
Progress = 15;
//fix
// CUSTOMER_LeakFlowThreshold
@@ -110,11 +116,9 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
//
var ts = DateTimeOffset.UtcNow - new DateTimeOffset(2000, 1, 1, 0, 0, 0, new TimeSpan(0));
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_SealDisplay",
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
foreach (var item in myJsonResponse.Where(m => m.Source == ProgrammingSource.Vako))
{
@@ -126,7 +130,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
//SENSUSRADIO_EncryptionKey dont reserve SENSUSRADIO_EncryptionKey!
if (item.RegisterName.ToLower().Contains("displaypow".ToLower()) || item.RegisterName.ToLower().Contains("METROLOGYASST_FlowPoint".ToLower()))
{
overAllResult.Add(_currentGenesis_WriteRegister(item.RegisterName, new byte[] { item.RegisterValue.ToArray()[0] }, true, true));
overAllResult.Add(_currentGenesis_WriteRegister(item.RegisterName, new[] { item.RegisterValue.ToArray()[0] }, true, true));
}
else if (item.RegisterName.ToLower().Contains("SENSUSRADIO_EncryptionKey".ToLower()))
{
@@ -138,18 +142,15 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
}
//else if (!item.RegisterName.ToLower().Contains("apparrangement"))
//{
// overAllResult.Add(_currentGenesis_WriteRegister(item.RegisterName, item.RegisterValue.Reverse().ToArray(), true, true));
//}
}
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_AlarmEnableMask", new byte[] { 0x00, 0x00, 0x80, 0x53 }.Reverse().ToArray(), true, false)); ;
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_AlarmBroadcastMask", new byte[] { 0x00, 0x00, 0x1f, 0xdc }.Reverse().ToArray(), true, false));
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_AlarmVisualMask", new byte[] { 0x00, 0x00, 0x1f, 0xdc }.Reverse().ToArray(), true, false));
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_AlarmEnableMask", new Byte[] { 0x00, 0x00, 0x80, 0x53 }.Reverse().ToArray()));
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_AlarmBroadcastMask", new Byte[] { 0x00, 0x00, 0x1f, 0xdc }.Reverse().ToArray()));
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_AlarmVisualMask", new Byte[] { 0x00, 0x00, 0x1f, 0xdc }.Reverse().ToArray()));
foreach (var item in myJsonResponse.Where(m => m.Source == ProgrammingSource.Csd))
{
@@ -166,35 +167,27 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
}
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_ResetAccumulators",
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, false));
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray()));
overAllResult.Add(wirteRegisterInBetweenCheck("SYSTEM_CalendarSeconds", Convert.ToInt32(ts.TotalSeconds)));
overAllResult.Add(wirteRegisterInBetweenCheck("IRDA_MfgDate", Convert.ToInt32(ts.TotalSeconds)));
overAllResult.Add(_currentGenesis_WriteRegister("LOGGER_TriggerLogFlush",
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, false));
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray()));
overAllResult.Add(_currentGenesis_WriteRegister("NFC_EraseRMA",
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, false));
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray()));
if (hasRadio)
{
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_ResetCounter",
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, false));
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray()));
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_SealDisplay",
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, true));
}
var ret = true;
int done = 0;
Int32 done = 0;
foreach (var cTask in overAllResult)
{
@@ -204,39 +197,34 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
cTask.RunSynchronously();
if (cTask.Result.Item2)
{
base.NewStatus($"Schreiben des Parameter {cTask.Result.Item1} war erfolgreich");
NewStatus($"Schreiben des Parameter {cTask.Result.Item1} war erfolgreich");
}
else
{
if (cTask.Result.Item1.ToLower().Contains("Metersize".ToLower()) || cTask.Result.Item1.ToLower().Contains("NFC_EraseRMA".ToLower()) || cTask.Result.Item1.ToLower().Contains("CUSTOMER_ExcessFlowVolumeThreshold".ToLower()) || cTask.Result.Item1.ToLower().Contains("CUSTOMER_LeakFlowThreshold".ToLower()) || cTask.Result.Item1.ToLower() == "SENSUSRADIO_MetroRadioLifeTimeCounter".ToLower())
if (cTask.Result.Item1.ToLower().Contains("Metersize".ToLower()) || cTask.Result.Item1.ToLower().Contains("NFC_EraseRMA".ToLower()) || cTask.Result.Item1.ToLower().Contains("CUSTOMER_ExcessFlowVolumeThreshold".ToLower()) || cTask.Result.Item1.ToLower().Contains("CUSTOMER_LeakFlowThreshold".ToLower()) || cTask.Result.Item1.ToLower() == "SENSUSRADIO_MetroRadioLifeTimeCounter".ToLower())
{
base.NewStatus($"Warnung!Schreiben des Parameter {cTask.Result.Item1} war nicht erfolgreich");
NewStatus($"Warnung! Fehler beim Schreiben des Parameters {cTask.Result.Item1}");
}
else
{
base.NewStatus($"Warnung!Schreiben des Parameter {cTask.Result.Item1} war nicht erfolgreich");
NewStatus($"Warnung! Fehler beim Schreiben des Parameters {cTask.Result.Item1}");
ret = false;
break;
}
}
}
catch (Exception ex)
catch (Exception)
{
if (cTask.Result.Item1 != "GENESISFLOW_MaxDeltaToFRange")
{
throw;
}
}
base.Progress = 15 + ((Int32)Math.Round(((Double)done / (Double)overAllResult.Count) * 85, 0));
done = done + 1;
Progress = 15 + ((Int32)Math.Round((done / (Double)overAllResult.Count) * 85, 0));
done += 1;
}
if (!ret)
{
@@ -246,35 +234,28 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
currentProcessState = ProductionProcessState.Done;
return;
}
reTrysLeft = reTrysLeft - 1;
remainingRetries -= 1;
}
else
{
base.currentProcessState = ProductionProcessState.Error;
reTrysLeft = -1;
base.NewStatus($"Warnung!Fehler beim laden des Parametersatzes");
currentProcessState = ProductionProcessState.Error;
remainingRetries = -1;
NewStatus("Warnung! Fehler beim Laden des Parametersatzes");
}
}
catch (Exception ex)
{
base.currentProcessState = ProductionProcessState.Error;
base.NewStatus($"Warnung!Fehler bei behandeln {ex.Message}");
reTrysLeft = reTrysLeft - 1;
currentProcessState = ProductionProcessState.Error;
NewStatus($"Warnung! Fehler beim Behandeln von {ex.Message}");
remainingRetries = remainingRetries - 1;
}
}
}
public override void StartProcess()
{
doStartProcessLoop();
}
}
}
@@ -1,9 +1,9 @@
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using System;
using System;
using System.Linq;
using System.Windows.Controls;
using System.Windows.Threading;
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
namespace ProductionUiCordonel.ProductionProcesses.Actions
@@ -26,7 +26,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -55,10 +55,11 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
try
{
var done1 = done;
UserControl.lblText.Dispatcher.Invoke(DispatcherPriority.Send,
new Action(() =>
{
UserControl.lblText.Content = $"Read {dic.GetIdent()}({done}/{total.Count})";
UserControl.lblText.Content = $"Read {dic.GetIdent()}({done1}/{total.Count})";
}
));
if (dic.RegisterName.ToLower() != "password" && dic.RegisterDetail.Privilege.Lvl8 != Access.Wo)
@@ -82,14 +83,14 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
}
}
base.Progress = (Int32)Math.Round(((Double)done / (Double)total.Count) * 100, 0);
Progress = (Int32)Math.Round(((Double)done / total.Count) * 100, 0);
}
catch (Exception e)
catch (Exception )
{
//todo: error logger
}
done = done + 1;
done += 1;
}
Meter.StoreCurrentRegisterDic();
@@ -97,13 +98,10 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
currentProcessState = ProductionProcessState.Done;
}
catch (Exception e)
catch (Exception )
{
currentProcessState = ProductionProcessState.Error;
}
}
}
}
@@ -1,23 +1,21 @@
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Controls;
using Newtonsoft.Json;
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Logic.ProductionOrderCore;
using Xylem.Common.Logic.SoftwareAccessHelper;
namespace ProductionUiCordonel.ProductionProcesses.Actions
{
public class ProductionProcessGetFinalParameterizationVakoCsd : BaseProductionProcess
public class ProductionProcessGetFinalParametrizationVakoCsd : BaseProductionProcess
{
public IList<ProgrammingParameters> Result = new List<ProgrammingParameters>();
private UcPlain UserControl;
public ProductionProcessGetFinalParameterizationVakoCsd()
public ProductionProcessGetFinalParametrizationVakoCsd()
{
name = "Hole Kunden Parametrierung";
currentProcessState = ProductionProcessState.Waiting;
@@ -33,7 +31,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -47,47 +45,42 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
private void doStartProcessLoop()
{
var reTrysLeft = 2;
while (reTrysLeft >= 0)
var retriesRemaining = 2;
while (retriesRemaining >= 0)
{
try
{
base.Progress = 0;
Progress = 0;
//var url = $"http://localhost:56011/api/FinalCheck/GetProgrammingParameters?PcbID={Meter.PcbId}";
var url = $"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetProgrammingParameters?PcbID={Meter.PcbId}";
var csdRet = LocalWebRequest.GetRequest(url, 60000);
Result = Newtonsoft.Json.JsonConvert.DeserializeObject<IList<ProgrammingParameters>>(csdRet);
Result = JsonConvert.DeserializeObject<IList<ProgrammingParameters>>(csdRet);
base.Progress = 100;
Progress = 100;
if (!Result.Any())
{
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
else
{
currentProcessState = ProductionProcessState.Done;
return;
}
reTrysLeft = reTrysLeft - 1;
retriesRemaining -= 1;
}
catch (Exception ex)
catch (Exception )
{
base.currentProcessState = ProductionProcessState.Error;
reTrysLeft = reTrysLeft - 1;
currentProcessState = ProductionProcessState.Error;
retriesRemaining -= 1;
}
}
}
public override void StartProcess()
{
doStartProcessLoop();
}
}
}
@@ -1,10 +1,10 @@
using Logic.ProductionToProductMapper.Cordonel;
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using System;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Windows.Controls;
using Logic.ProductionToProductMapper.Cordonel;
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Logic.SoftwareAccessHelper;
@@ -30,7 +30,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -1,13 +1,12 @@
using Newtonsoft.Json;
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Windows.Controls;
using Newtonsoft.Json;
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile;
using Xylem.Common.Logic.SoftwareAccessHelper;
@@ -33,41 +32,32 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
private void updateImage(Image ctlImage, bool? success = null)
private void updateImage(Image ctlImage, Boolean? success = null)
{
string path = "/Resources/iconWating.png";
if (success.HasValue)
{
if (success.Value)
{
path = "/Resources/iconCheck.png";
}
else
{
path = "/Resources/iconWarn.png";
}
}
}
public override void StartProcess()
{
bool ret = RequestPassword();
Boolean ret = RequestPassword();
updateImage(UserControl.RequestPassword, ret);
base.Progress = base.Progress + 16;
Progress += 16;
if (Encoding.UTF8.GetString(pwContainer.listOfPasswords.Last()) == pwContainer.Skeleton)//pwContainer.Skeleton )
{
NewStatus("Passwörter schon geschrieben. Prozess wird übersprungen");
base.currentProcessState = ProductionProcessState.Done;
currentProcessState = ProductionProcessState.Done;
return;
}
@@ -80,15 +70,15 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
updateImage(UserControl.CreateFile, ret);
base.Progress = base.Progress + 16;
Progress += 16;
if (ret)
{
ret = WritePasswordFileToMeter();
}
updateImage(UserControl.WriteToMeter, ret);
base.Progress = base.Progress + 16;
//Check if new password is in the meter ... even the file wirte wasnt succesfull
Progress += 16;
//Check if new password is in the meter ... even the file write wasn't successful
if (!ret)
{
Meter.Logout();
@@ -100,14 +90,14 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
ret = UpdatePasswordinDb();
}
updateImage(UserControl.UpdatePassword, ret);
base.Progress = base.Progress + 16;
Progress += 16;
if (ret)
{
ret = Meter.Logout();
}
updateImage(UserControl.Logout, ret);
base.Progress = base.Progress + 16;
Progress += 16;
if (ret)
@@ -115,15 +105,15 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
ret = Meter.Login();
}
updateImage(UserControl.CheckNewPassword, ret);
base.Progress = 100;
Progress = 100;
if (!ret)
{
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
else
{
base.currentProcessState = ProductionProcessState.Done;
currentProcessState = ProductionProcessState.Done;
}
}
public override void ProcessDone()
@@ -136,42 +126,43 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
public Int64? orderNumber = null;
public Int64? radioAdress = null;
public string Skeleton = "";
public List<byte[]> listOfHashes = new List<byte[]>();
public List<byte[]> listOfPasswords = new List<byte[]>();
public String Skeleton = "";
public List<Byte[]> listOfHashes = new List<Byte[]>();
public List<Byte[]> listOfPasswords = new List<Byte[]>();
}
private MeterPasswordContainer pwContainer = new MeterPasswordContainer();
private MeterPwdFile meterPwdFile;
public bool RequestPassword()
public Boolean RequestPassword()
{
base.NewStatus($"Request Passwords");
NewStatus("Request Passwords");
var url = ServiceUrls.GenesisGetPasswordContainerServiceUrl();
//url = "http://localhost:56011/api/Password/GetPasswordHashFileContent?PcbId=";
url = ($"{url}{Meter.PcbId}");
var errorCode = 0;
var header = new Dictionary<string, string>();
header.Add("Cache-Control", "no-cache");
header.Add("X-Node-Token", "d5b8c0b2-81f6-4421-80d0-44eb2093e616");
var resp = LocalWebRequest.GetRequestWithError(url, out errorCode, 20000, header,true);
var header = new Dictionary<String, String>
{
{ "Cache-Control", "no-cache" },
{ "X-Node-Token", "d5b8c0b2-81f6-4421-80d0-44eb2093e616" }
};
var resp = LocalWebRequest.GetRequestWithError(url, out var errorCode, 20000, header,true);
if (errorCode == HttpStatusCode.OK.GetHashCode())
{
pwContainer = JsonConvert.DeserializeObject<MeterPasswordContainer>(resp);
base.NewStatus($"Passwörter verfügbar");
NewStatus("Passwörter verfügbar");
return true;
}
return false;
}
public bool CreatePasswordFile()
public Boolean CreatePasswordFile()
{
meterPwdFile = new MeterPwdFile(Meter);
return meterPwdFile.BuildPwdFile(pwContainer.listOfPasswords, 1, pwContainer.Skeleton);
}
public bool WritePasswordFileToMeter()
public Boolean WritePasswordFileToMeter()
{
if (meterPwdFile.UnlockEraseWriteMeterPwdFile())
{
@@ -179,7 +170,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
}
return false;
}
public bool UpdatePasswordinDb()
public Boolean UpdatePasswordinDb()
{
var newPs = Encoding.UTF8.GetString(pwContainer.listOfPasswords.Last());
@@ -1,23 +1,23 @@
using ProductionUiCordonel.ProductionProcesses.Enum;
using System;
using System.Collections.Generic;
using System;
using System.Configuration;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using ProductionUiCordonel.UserControls.FinalTest;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Threading;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using SIRTCOM;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using System.Net;
using System.IO;
using Newtonsoft.Json;
using Xylem.Common.CommonCore.Configuration;
using System.Configuration;
using System.Net.Http;
using System.Windows.Threading;
using Newtonsoft.Json.Linq;
using Xylem.Common.Logic.SoftwareAccessHelper;
using Button = System.Windows.Controls.Button;
using UserControl = System.Windows.Controls.UserControl;
namespace ProductionUiCordonel.ProductionProcesses.Actions
{
@@ -36,12 +36,12 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
UserControl = new UcRadioCheck();
UserControl.OnRetryRequested += delegate (Object sender, EventArgs args) { GetRssi(); };
UserControl.OnRetryRequested += delegate { GetRssi(); };
UserControl.OnResetRequested += delegate (Object sender, EventArgs args) { Reset(); };
UserControl.OnForceAPam += delegate (Object sender, EventArgs args) { forcePush(); };
UserControl.OnDoneRequested += delegate (Object sender, EventArgs args)
UserControl.OnResetRequested += delegate { Reset(); };
UserControl.OnForceAPam += delegate { forcePush(); };
UserControl.OnDoneRequested += delegate
{
currentProcessState = ProductionProcessState.Done;
@@ -52,7 +52,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -66,13 +66,13 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
if (!ret)
{
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
}
//clear
}
private Byte[] SENSUSRADIO_WakeupInterval = null;
private Byte[] SENSUSRADIO_WakeupInterval;
public override void StartProcess()
{
@@ -89,7 +89,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
EncyptionKey = LocalWebRequest.GetRequest($"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetEncryptionKey?PcbID={Meter.PcbId}", 80000).ToUpper().Trim('\"');
if (!EncyptionKey.Equals(BitConverter.ToString(enc.ToArray()).Replace("-", "")))
{
System.Windows.Forms.MessageBox.Show("Funkschlüssel überprüfen!");
MessageBox.Show("Funkschlüssel überprüfen!");
}
EncyptionKey = BitConverter.ToString(enc.ToArray()).Replace("-", "");
@@ -102,9 +102,9 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
//{
// Comport = 7;
//}
BoxNr = Convert.ToByte(ConfigurationManager.AppSettings[$"SirtBoxNr"]);
BoxNr = Convert.ToByte(ConfigurationManager.AppSettings["SirtBoxNr"]);
DebugMessage($"Start RadioCheck Comport:{Comport} ,BoxNr:{BoxNr}, freq: {freq}, RadioAdress:{RadioAdress}s\r\n", false);
DebugMessage($"Start RadioCheck Comport:{Comport} ,BoxNr:{BoxNr}, freq: {freq}, RadioAddress:{RadioAdress}s\r\n");
Meter.WriteRegister("SENSUSRADIO_IrDAModulePresent", 1, true, true);
@@ -119,27 +119,27 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
#region FormerForm
private SaveData saveData;
private SIRTCOM.Statemashine stm;
private Statemashine stm;
private static HttpClient httpclient;
private byte? RSSI_PAM_Min;
private byte? RSSI_PAM_Max;
private byte? RSSI_PAM;
private byte? RSSI_SEMI_Min;
private byte? RSSI_SEMI_Max;
private byte? RSSI_SEMI;
private Byte? RSSI_PAM_Min;
private Byte? RSSI_PAM_Max;
private Byte? RSSI_PAM;
private Byte? RSSI_SEMI_Min;
private Byte? RSSI_SEMI_Max;
private Byte? RSSI_SEMI;
public byte BoxNr;
public Byte BoxNr;
public int Ordernumber;
public Int32 Ordernumber;
public UInt32 RadioAdress;
public byte Comport;
public Byte Comport;
public string EncyptionKey = "";
public String EncyptionKey = "";
private void enableBtn(Button btn, bool enable)
private void enableBtn(Button btn, Boolean enable)
{
btn.Dispatcher.Invoke(DispatcherPriority.Send,
new Action(() =>
@@ -179,7 +179,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
await GetRssiMinMaxAsync(BoxNr, Ordernumber);
SetUi();
GetRSSI((int)RadioAdress, Comport, EncyptionKey);
GetRSSI((Int32)RadioAdress, Comport, EncyptionKey);
SetUi();
}
catch (Exception ex)
@@ -207,7 +207,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
stm.ClearPam();
stm.Stop();
}
DebugMessage("Reset\r\n", false);
DebugMessage("Reset\r\n");
clearRssi();
SetUi();
StartProcess();
@@ -216,10 +216,10 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
private class SaveData
{
public Int32 RadioAdress { get; set; }
public byte RSSI_PAM { get; set; }
public byte RSSI_SEMI { get; set; }
public int LimitId { get; set; }
public byte Result { get; set; }
public Byte RSSI_PAM { get; set; }
public Byte RSSI_SEMI { get; set; }
public Int32 LimitId { get; set; }
public Byte Result { get; set; }
}
@@ -231,9 +231,9 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
DebugMessage("Calling SaveRSSI Webservice...", true);
try
{
saveData.RadioAdress = (int)RadioAdress; // 0-4294967295
string url = $"{ServiceUrls.GenesisRadioCheckServiceUrl()}SaveRSSI";
string body = JsonConvert.SerializeObject(saveData);
saveData.RadioAdress = (Int32)RadioAdress; // 0-4294967295
String url = $"{ServiceUrls.GenesisRadioCheckServiceUrl()}SaveRSSI";
String body = JsonConvert.SerializeObject(saveData);
await PostDataAsync(url, body);
DebugMessage(" Ready\r\n", true);
}
@@ -244,14 +244,14 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
}
private async Task GetRssiMinMaxAsync(byte BoxNr, Int32 FaNr)
private async Task GetRssiMinMaxAsync(Byte BoxNr, Int32 FaNr)
{
//DebugMessage("Calling GetLimits Webservice...", true);
try
{
// TODO anpassen
string url = $"{ServiceUrls.GenesisRadioCheckServiceUrl()}GetLimits/{BoxNr}/{FaNr}";
string body = await GetResponseAsync(url);
String url = $"{ServiceUrls.GenesisRadioCheckServiceUrl()}GetLimits/{BoxNr}/{FaNr}";
String body = await GetResponseAsync(url);
JObject o = JObject.Parse(body);
saveData.LimitId = Convert.ToInt32(o.SelectToken("LimitId").ToString());
@@ -276,20 +276,20 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
}
}
private void GetRSSI(Int32 RadioAdress, Int32 ByteCOMPort, string strKey)
private void GetRSSI(Int32 RadioAdress, Int32 ByteCOMPort, String strKey)
{
RSSI_PAM = null;
RSSI_SEMI = null;
stm = new SIRTCOM.Statemashine();
stm = new Statemashine();
byte P81_1 = 0;
Byte P81_1 = 0;
saveData.RadioAdress = RadioAdress;
stm.initialise((byte)ByteCOMPort);
SIRTCOM.Wrapper wrp = new SIRTCOM.Wrapper();
stm.initialise((Byte)ByteCOMPort);
Wrapper wrp = new Wrapper();
stm.StartLoggin("C:\\GenesisLog\\log.txt");
// ist wohl nicht nötig da der SIRT richtig konfiguroert ist:
@@ -313,7 +313,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
stm.OnStateChanged += Stm_OnStateChanged;
stm.Start(); // Start polling
DebugMessage($" OK\r\n", true);
DebugMessage(" OK\r\n", true);
Meter.ResetAlarm(GenesisMeter.Alarm.EMPTY_PIPE);
Thread.Sleep(5000);
//Meter.WriteRegister("SENSUSRADIO_SYSTEMSTATE", 0x01, true, false);
@@ -327,17 +327,17 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
private void forcePush()
{
Meter.WriteRegister("SENSUSRADIO_SYSTEMSTATE", 0x55, true, false);
Meter.WriteRegister("SENSUSRADIO_SYSTEMSTATE", 0x02, true, false);
Meter.WriteRegister("SENSUSRADIO_SYSTEMSTATE", 0x55);
Meter.WriteRegister("SENSUSRADIO_SYSTEMSTATE", 0x02);
}
public void DebugMessage(string value, Boolean Append = false)
public void DebugMessage(String value, Boolean Append = false)
{
NewStatus(value);
}
private void GotRSSICallback(byte Rssi_Semi_Sirt, byte Rssi_Pam_Cord)
private void GotRSSICallback(Byte Rssi_Semi_Sirt, Byte Rssi_Pam_Cord)
{
// RSSI beim Empfangen der PAM gemessen vom Cordonel (Sendestärke des SIRT verpackt in SEMI, byte 20)
DebugMessage($"RSSI Cord of PAM (Sirt => Cord):{Rssi_Pam_Cord}\r\n", true);
@@ -376,21 +376,21 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
SetUi();
if (saveData.Result == 1)
{
UserControl.ViewResult(10);
UserControl.ViewResult();
}
}
private void Stm_OnStateChanged(object sender, SIRTCOM.MyEventArgs e)
private void Stm_OnStateChanged(Object sender, MyEventArgs e)
{
// our Pam
SIRTCOM.PAM Pam = stm.GetPAM(1);
PAM Pam = stm.GetPAM(1);
if (Pam.State == SIRTCOM.PAM.PAMStates.Timeout)
if (Pam.State == PAM.PAMStates.Timeout)
{
DebugMessage($"Timeout nach {Pam.GetTime()} s\r\n", false);
DebugMessage($"Timeout nach {Pam.GetTime()} s\r\n");
}
if (Pam.CountSemi > 0)
@@ -401,20 +401,20 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
stm.Stop();
stm.ClearPam();
string HexbytesSEMI = Pam.Semi.HexData.Replace(" ", "");
byte[] SEMI_bytes = new byte[HexbytesSEMI.Length / 2];
String HexbytesSEMI = Pam.Semi.HexData.Replace(" ", "");
Byte[] SEMI_bytes = new Byte[HexbytesSEMI.Length / 2];
for (int i = 0; i < HexbytesSEMI.Length; i += 2)
for (Int32 i = 0; i < HexbytesSEMI.Length; i += 2)
SEMI_bytes[i / 2] = Convert.ToByte(HexbytesSEMI.Substring(i, 2), 16);
// SEMI Status
if (SEMI_bytes[19] == 0)
{
// RSSI beim Empfangen der SEMI gemessen vom Sirt
byte Semi_Rssi_Sirt = SEMI_bytes[2];
Byte Semi_Rssi_Sirt = SEMI_bytes[2];
// RSSI beim Empfangen der PAM gemessen vom Cordonel
byte Pam_Rssi_Cord = SEMI_bytes[20];
Byte Pam_Rssi_Cord = SEMI_bytes[20];
GotRSSICallback(Semi_Rssi_Sirt, Pam_Rssi_Cord);
}
@@ -431,7 +431,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
}
}
public static async Task<string> PostDataAsync(string url, string data)
public static async Task<String> PostDataAsync(String url, String data)
{
httpclient = new HttpClient();
// 20 Sekunden Timeout
@@ -441,11 +441,11 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
HttpResponseMessage response = await httpclient.PostAsync(url, queryString);
response.EnsureSuccessStatusCode();
string content = await response.Content.ReadAsStringAsync();
String content = await response.Content.ReadAsStringAsync();
return content;
}
static async Task<string> GetResponseAsync(string url)
static async Task<String> GetResponseAsync(String url)
{
httpclient = new HttpClient();
// 20 Sekunden Timeout
@@ -454,7 +454,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
HttpResponseMessage response = httpclient.GetAsync(url).Result;
response.EnsureSuccessStatusCode();
string content = await response.Content.ReadAsStringAsync();
String content = await response.Content.ReadAsStringAsync();
return content;
}
@@ -1,10 +1,10 @@
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Windows.Controls;
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile;
@@ -13,9 +13,9 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
public class ProductionProcessShippingMode : BaseProductionProcess
{
private UcPlain UserControl;
private bool doRestart = false;
private bool hasRadio = false;
public ProductionProcessShippingMode(bool restart = false, bool registerHasRadio = true)
private Boolean doRestart;
private Boolean hasRadio;
public ProductionProcessShippingMode(Boolean restart = false, Boolean registerHasRadio = true)
{
name = "Versandbereitschaft herstellen";
currentProcessState = ProductionProcessState.Waiting;
@@ -33,7 +33,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -48,7 +48,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
Meter.ResetAlarm(GenesisMeter.Alarm.ALL);//(true, new byte[] { 0x00, 0x00, 0x00, 0x01 });
Meter.SetLcdText(true, new byte[] { 0x00, 0x00, 0x00, 0x01 });
Meter.SetLcdText(true, new Byte[] { 0x00, 0x00, 0x00, 0x01 });
Meter.ResetAlarm(GenesisMeter.Alarm.EMPTY_PIPE);//(true, new byte[] { 0x00, 0x00, 0x00, 0x01 });
@@ -58,12 +58,12 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
if (Meter.StoreAllConfigurations())
{
var writeList = new List<bool>();
writeList.Add(Meter.WriteRegister("SENSUSRADIO_SystemState", 1, true, false));
writeList.Add(Meter.WriteRegister("SENSUSRADIO_MainAlarmMask", 0, true, false));
writeList.Add(Meter.WriteRegister("SENSUSRADIO_ExtendedAlarmMask", 0, true, false));
var writeList = new List<Boolean>
{
Meter.WriteRegister("SENSUSRADIO_SystemState", 1),
Meter.WriteRegister("SENSUSRADIO_MainAlarmMask", 0),
Meter.WriteRegister("SENSUSRADIO_ExtendedAlarmMask", 0)
};
Thread.Sleep(15000);
@@ -86,16 +86,20 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
}
}
if (writeList.All(a => a == true))
if (writeList.All(a => a))
{
if (doRestart)
{
var CheckValuesAufterBoot = new List<Tuple<string, byte[]>>();
CheckValuesAufterBoot.Add(new Tuple<string, byte[]>("METROLOGYASST_PulseLength", Meter.ReadRegister("METROLOGYASST_PulseLength")));
CheckValuesAufterBoot.Add(new Tuple<string, byte[]>("POWERMON_BatteryQuantity", Meter.ReadRegister("POWERMON_BatteryQuantity")));
CheckValuesAufterBoot.Add(new Tuple<string, byte[]>("GENESISFLOW_MeterSize", Meter.ReadRegister("GENESISFLOW_MeterSize")));
CheckValuesAufterBoot.Add(new Tuple<string, byte[]>("GENESISFLOW_CalFactor1", Meter.ReadRegister("GENESISFLOW_CalFactor1")));
CheckValuesAufterBoot.Add(new Tuple<string, byte[]>("SENSUSRADIO_RadioAddress", Meter.ReadRegister("SENSUSRADIO_RadioAddress")));
var CheckValuesAfterBoot = new List<Tuple<String, Byte[]>>
{
new Tuple<String, Byte[]>("METROLOGYASST_PulseLength",
Meter.ReadRegister("METROLOGYASST_PulseLength")),
new Tuple<String, Byte[]>("POWERMON_BatteryQuantity",
Meter.ReadRegister("POWERMON_BatteryQuantity")),
new Tuple<String, Byte[]>("GENESISFLOW_MeterSize", Meter.ReadRegister("GENESISFLOW_MeterSize")),
new Tuple<String, Byte[]>("GENESISFLOW_CalFactor1", Meter.ReadRegister("GENESISFLOW_CalFactor1")),
new Tuple<String, Byte[]>("SENSUSRADIO_RadioAddress", Meter.ReadRegister("SENSUSRADIO_RadioAddress"))
};
var _meterResetPsu = new MeterResetPsu(Meter)
{
StoreConfigEnable = true
@@ -106,8 +110,8 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
Meter.Login();
bool? hasDiffrences = null;
foreach (var item in CheckValuesAufterBoot)
Boolean? hasDiffrences = null;
foreach (var item in CheckValuesAfterBoot)
{
if (!item.Item2.SequenceEqual(Meter.ReadRegister(item.Item1)))
{
@@ -125,7 +129,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
if (rebootSucceeded && hasDiffrences.HasValue && !hasDiffrences.Value)
{
Meter.WriteRegister("SENSUSRADIO_SystemState", 0xFF, true, false);
Meter.WriteRegister("SENSUSRADIO_SystemState", 0xFF);
Meter.Logout();
Thread.Sleep(5000);
Meter.Login();
@@ -134,12 +138,12 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
var SENSUSRADIO_SystemState = Meter.ReadRegister("SENSUSRADIO_SystemState");
if (SENSUSRADIO_SystemState[0] == 0x02 && SENSUSRADIO_MainAlarmMask[0] != 0)
{
base.currentProcessState = ProductionProcessState.Done;
currentProcessState = ProductionProcessState.Done;
}
else
{
Meter.WriteLog("resetRadio Failed");
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
@@ -148,12 +152,12 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
else
{
Meter.WriteLog("reboot compare failed");
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
}
else
{
Meter.WriteRegister("SENSUSRADIO_SystemState", 0xFF, true, false);
Meter.WriteRegister("SENSUSRADIO_SystemState", 0xFF);
Meter.Logout();
Thread.Sleep(5000);
Meter.Login();
@@ -162,19 +166,19 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
var SENSUSRADIO_SystemState = Meter.ReadRegister("SENSUSRADIO_SystemState");
if (SENSUSRADIO_SystemState[0] == 0x02 && SENSUSRADIO_MainAlarmMask[0] != 0)
{
base.currentProcessState = ProductionProcessState.Done;
currentProcessState = ProductionProcessState.Done;
}
else
{
Meter.WriteLog("resetRadio Failed");
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
}
}
else
{
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
@@ -187,11 +191,11 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (doRestart)
{
var CheckValuesAufterBoot = new List<Tuple<string, byte[]>>();
CheckValuesAufterBoot.Add(new Tuple<string, byte[]>("METROLOGYASST_PulseLength", Meter.ReadRegister("METROLOGYASST_PulseLength")));
CheckValuesAufterBoot.Add(new Tuple<string, byte[]>("POWERMON_BatteryQuantity", Meter.ReadRegister("POWERMON_BatteryQuantity")));
CheckValuesAufterBoot.Add(new Tuple<string, byte[]>("GENESISFLOW_MeterSize", Meter.ReadRegister("GENESISFLOW_MeterSize")));
CheckValuesAufterBoot.Add(new Tuple<string, byte[]>("GENESISFLOW_CalFactor1", Meter.ReadRegister("GENESISFLOW_CalFactor1")));
var CheckValuesAufterBoot = new List<Tuple<String, Byte[]>>();
CheckValuesAufterBoot.Add(new Tuple<String, Byte[]>("METROLOGYASST_PulseLength", Meter.ReadRegister("METROLOGYASST_PulseLength")));
CheckValuesAufterBoot.Add(new Tuple<String, Byte[]>("POWERMON_BatteryQuantity", Meter.ReadRegister("POWERMON_BatteryQuantity")));
CheckValuesAufterBoot.Add(new Tuple<String, Byte[]>("GENESISFLOW_MeterSize", Meter.ReadRegister("GENESISFLOW_MeterSize")));
CheckValuesAufterBoot.Add(new Tuple<String, Byte[]>("GENESISFLOW_CalFactor1", Meter.ReadRegister("GENESISFLOW_CalFactor1")));
var _meterResetPsu = new MeterResetPsu(Meter)
{
@@ -203,7 +207,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
Meter.Login();
bool? hasDiffrences = null;
Boolean? hasDiffrences = null;
foreach (var item in CheckValuesAufterBoot)
{
if (!item.Item2.SequenceEqual(Meter.ReadRegister(item.Item1)))
@@ -221,23 +225,23 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
if (rebootSucceeded && hasDiffrences.HasValue && !hasDiffrences.Value)
{
base.currentProcessState = ProductionProcessState.Done;
currentProcessState = ProductionProcessState.Done;
}
else
{
Meter.WriteLog("reboot compare failed");
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
}
else
{
base.currentProcessState = ProductionProcessState.Done;
currentProcessState = ProductionProcessState.Done;
}
return;
}
}
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
@@ -1,14 +1,9 @@
using ProductionUiCordonel.ProductionProcesses.Enum;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using System.Threading;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
namespace ProductionUiCordonel.ProductionProcesses.Actions
{
@@ -16,7 +11,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
private UcDialog UserControl;
public bool DialogIsDone { get; private set; }
public Boolean DialogIsDone { get; }
public ProductionProcessSpecialConfig()
{
@@ -33,7 +28,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -46,7 +41,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
private void StepDone()
{
base.currentProcessState = ProductionProcessState.Done;
currentProcessState = ProductionProcessState.Done;
}
private void StepRadio()
@@ -57,7 +52,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
var radioDefault = new UcDialog.DialogOption("old default", "same as iperl", () =>
{
var funkadresse = new List<byte>();
var funkadresse = new List<Byte>();
funkadresse.AddRange((new Byte[] { 0xE6, 0xC8, 0x88, 0x00 }).ToArray());
funkadresse.AddRange((new Byte[] { 0xDE, 0xB8, 0x68, 0xC0 }).ToArray());
funkadresse.AddRange((new Byte[] { 0xD6, 0xA8, 0x48, 0x80 }).ToArray());
@@ -79,7 +74,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
var optOneLiter = new UcDialog.DialogOption("new default", "new default key", () =>
{
var funkadresse = new List<byte>();
var funkadresse = new List<Byte>();
funkadresse.AddRange((new Byte[] { 0x0E, 0x9F, 0xAC, 0xC6 }).ToArray());
funkadresse.AddRange((new Byte[] { 0xA0, 0xE1, 0xEF, 0x1C }).ToArray());
funkadresse.AddRange((new Byte[] { 0x3B, 0x27, 0xA4, 0x9B }).ToArray());
@@ -158,12 +153,9 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
UserControl.SetDialogOptions(pulseOptionList);
}
public override async void StartProcess()
public override void StartProcess()
{
StepPulse();
}
}
@@ -1,21 +1,19 @@
using ProductionUiCordonel.ProductionProcesses.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Controls;
using ProductionUiCordonel.ProductionProcesses.Enum;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
namespace ProductionUiCordonel.ProductionProcesses
{
public abstract class BaseProductionProcess : IProductionProcess
{
private int _progress = 0;
public int Progress
private Int32 _progress;
public Int32 Progress
{
get { return _progress; }
get => _progress;
set
{
_progress = value;
@@ -23,7 +21,7 @@ namespace ProductionUiCordonel.ProductionProcesses
}
}
public ProductionProcessState currentProcessState;
public string name;
public String name;
public GenesisMeter Meter { get; internal set; }
@@ -34,7 +32,7 @@ namespace ProductionUiCordonel.ProductionProcesses
StringBuilder sbLog = new StringBuilder();
public string GetName()
public String GetName()
{
return name;
}
@@ -73,7 +71,7 @@ namespace ProductionUiCordonel.ProductionProcesses
}
internal void NewStatus(string v)
internal void NewStatus(String v)
{
PopUpProcessLogHandler?.Invoke(this, new PopUpProcessLogArgs(v));
sbLog.AppendLine(v);
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProductionUiCordonel.ProductionProcesses.Enum
{
@@ -16,7 +12,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Enum
public static class ProductionProcessStateHelper
{
public static string GetTextFromProductionProcessState(ProductionProcessState sate)
public static String GetTextFromProductionProcessState(ProductionProcessState sate)
{
switch (sate)
{
@@ -1,11 +1,7 @@
using ProductionUiCordonel.ProductionProcesses.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Controls;
using ProductionUiCordonel.ProductionProcesses.Enum;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
namespace ProductionUiCordonel.ProductionProcesses
@@ -17,7 +13,7 @@ namespace ProductionUiCordonel.ProductionProcesses
event EventHandler<PopUpProcessProgressArgs> PopUpProcessProgressChangedHandler;
event EventHandler<PopUpProcessLogArgs> PopUpProcessLogHandler;
string GetName();
String GetName();
ProductionProcessState GetState();
UserControl GetUserControl();
void Start(GenesisMeter Meter,CancellationToken cancellationToken);
@@ -1,11 +1,9 @@
using ProductionUiCordonel.ProductionProcesses.Actions;
using ProductionUiCordonel.ProductionProcesses.Enum;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using ProductionUiCordonel.ProductionProcesses.Enum;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
namespace ProductionUiCordonel.ProductionProcesses
@@ -96,12 +94,12 @@ namespace ProductionUiCordonel.ProductionProcesses
}
private void Process_PopUpProcessProgressChangedHandler(object sender, PopUpProcessProgressArgs e)
private void Process_PopUpProcessProgressChangedHandler(Object sender, PopUpProcessProgressArgs e)
{
ProcessProgressHandler?.Invoke(sender,e);
}
private void Process_PopUpProcessLogHandler(object sender, PopUpProcessLogArgs e)
private void Process_PopUpProcessLogHandler(Object sender, PopUpProcessLogArgs e)
{
ProcessLogHandler?.Invoke(sender,e);
}
@@ -1,15 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProductionUiCordonel.ProductionProcesses
{
public class PopUpProcessLogArgs : EventArgs
{
public readonly string Data;
public PopUpProcessLogArgs(string text)
public readonly String Data;
public PopUpProcessLogArgs(String text)
{
Data = text;
}
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProductionUiCordonel.ProductionProcesses
{
@@ -14,8 +10,8 @@ namespace ProductionUiCordonel.ProductionProcesses
SubProcess,
}
public readonly ProcessProgessType ProgressType;
public readonly int Progress;
public PopUpProcessProgressArgs(int progress, ProcessProgessType type)
public readonly Int32 Progress;
public PopUpProcessProgressArgs(Int32 progress, ProcessProgessType type)
{
Progress = progress;
ProgressType = type;
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProductionUiCordonel.ProductionProcesses
{
@@ -139,9 +139,13 @@
<Compile Include="ctls\ctlMultiModePressure.xaml.cs">
<DependentUpon>ctlMultiModePressure.xaml</DependentUpon>
</Compile>
<Compile Include="Data\FinalTestState.cs" />
<Compile Include="Data\FinalTestStateInfo.cs" />
<Compile Include="Data\FinalTestStateText.cs" />
<Compile Include="Data\PickingResultData.cs" />
<Compile Include="Data\PressureResultDataNotifyable.cs" />
<Compile Include="Event\StringArgs.cs" />
<Compile Include="Model\FinalTestModel.cs" />
<Compile Include="Model\MultiModeMasterViewModel.cs" />
<Compile Include="Model\PressureMultiModeViewModel.cs" />
<Compile Include="Model\MultiModeChildViewModel.cs" />
@@ -159,14 +163,14 @@
<Compile Include="ProductionProcesses\Actions\ProductionProcessCheckOrderNumber.cs" />
<Compile Include="ProductionProcesses\Actions\ProductionProcessCheckAttachment.cs" />
<Compile Include="ProductionProcesses\Actions\ProductionCheckShippingState.cs" />
<Compile Include="ProductionProcesses\Actions\ProductionProcessGetFinalParameterizationVakoCsd.cs" />
<Compile Include="ProductionProcesses\Actions\ProductionProcessFinalParameterizationVakoCsd.cs" />
<Compile Include="ProductionProcesses\Actions\ProductionProcessGetFinalParametrizationVakoCsd.cs" />
<Compile Include="ProductionProcesses\Actions\ProductionProcessFinalParametrizationVakoCsd.cs" />
<Compile Include="ProductionProcesses\Actions\ProductionProcessLogOff.cs" />
<Compile Include="ProductionProcesses\Actions\ProductionProcessShippingMode.cs" />
<Compile Include="ProductionProcesses\Actions\ProductionProcessRadioCheck.cs" />
<Compile Include="ProductionProcesses\Actions\ProductionProcessDone.cs" />
<Compile Include="ProductionProcesses\Actions\ProductionProcessSpecialConfig.cs" />
<Compile Include="ProductionProcesses\Actions\ProductionProcessFinalParameterizationFix.cs" />
<Compile Include="ProductionProcesses\Actions\ProductionProcessFinalParametrizationFix.cs" />
<Compile Include="ProductionProcesses\Actions\ProductionProcessFullReadOut.cs" />
<Compile Include="ProductionProcesses\Actions\ProductionProcessConnect.cs" />
<Compile Include="ProductionProcesses\Actions\ProductionProcessPasswordFile.cs" />
@@ -177,6 +181,11 @@
<Compile Include="ProductionProcesses\PopUpProcessLogArgs.cs" />
<Compile Include="ProductionProcesses\PopUpProcessProgressArgs.cs" />
<Compile Include="ProductionProcesses\ProcessStateChangedArgs.cs" />
<Compile Include="Properties\Resources.de.Designer.cs">
<DependentUpon>Resources.de.resx</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="UserControls\FinalTest\UcBarcodeInput.xaml.cs">
<DependentUpon>UcBarcodeInput.xaml</DependentUpon>
</Compile>
@@ -273,9 +282,15 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.de.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.de.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="ProductionUiCordonel_TemporaryKey.pfx" />
@@ -347,6 +362,10 @@
<Project>{4B88B0D3-E791-4774-9521-EABEACDC420E}</Project>
<Name>Logging</Name>
</ProjectReference>
<ProjectReference Include="..\Utils\ProcessExec\ProcessExec.csproj">
<Project>{2fd60cf1-45cd-4060-b8e5-4f39fba7f1cb}</Project>
<Name>ProcessExec</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\iconCheck.png">
@@ -1,6 +1,4 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
+53 -29
View File
@@ -8,10 +8,16 @@
// </auto-generated>
//------------------------------------------------------------------------------
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Drawing;
using System.Globalization;
using System.Resources;
using System.Runtime.CompilerServices;
namespace ProductionUiCordonel.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
@@ -19,27 +25,27 @@ namespace ProductionUiCordonel.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[DebuggerNonUserCode()]
[CompilerGenerated()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
private static CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProductionUiCordonel.Properties.Resources", typeof(Resources).Assembly);
if (ReferenceEquals(resourceMan, null)) {
ResourceManager temp = new ResourceManager("ProductionUiCordonel.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
@@ -50,8 +56,8 @@ namespace ProductionUiCordonel.Properties {
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture {
get {
return resourceCulture;
}
@@ -63,70 +69,88 @@ namespace ProductionUiCordonel.Properties {
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap CLEARMAtrix {
internal static Bitmap CLEARMAtrix {
get {
object obj = ResourceManager.GetObject("CLEARMAtrix", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
return ((Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Connect_16x {
internal static Bitmap Connect_16x {
get {
object obj = ResourceManager.GetObject("Connect_16x", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
return ((Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ConnectPlugged_16x {
internal static Bitmap ConnectPlugged_16x {
get {
object obj = ResourceManager.GetObject("ConnectPlugged_16x", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
return ((Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap iconCheck {
internal static Bitmap iconCheck {
get {
object obj = ResourceManager.GetObject("iconCheck", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
return ((Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap iconWarn {
internal static Bitmap iconWarn {
get {
object obj = ResourceManager.GetObject("iconWarn", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
return ((Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap iconWating {
internal static Bitmap iconWating {
get {
object obj = ResourceManager.GetObject("iconWating", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
return ((Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Refresh_16x {
internal static Bitmap Refresh_16x {
get {
object obj = ResourceManager.GetObject("Refresh_16x", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
return ((Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to Idle.
/// </summary>
internal static string StrStateIdle {
get {
return ResourceManager.GetString("StrStateIdle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Initial start.
/// </summary>
internal static string StrStateStartInitial {
get {
return ResourceManager.GetString("StrStateStartInitial", resourceCulture);
}
}
}
@@ -0,0 +1,148 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="ConnectPlugged_16x" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ConnectPlugged_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Connect_16x" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Connect_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="iconCheck" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\iconCheck.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="iconWarn" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\iconWarn.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="iconWating" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\iconWating.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Refresh_16x" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Refresh_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="CLEARMAtrix" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\CLEARMAtrix.JPG;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="StrStateIdle" xml:space="preserve">
<value>Leerlauf</value>
</data>
<data name="StrStateStartInitial" xml:space="preserve">
<value>Neustart</value>
</data>
</root>
@@ -139,4 +139,10 @@
<data name="CLEARMAtrix" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\CLEARMAtrix.JPG;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="StrStateIdle" xml:space="preserve">
<value>Idle</value>
</data>
<data name="StrStateStartInitial" xml:space="preserve">
<value>Initial start</value>
</data>
</root>
+8 -4
View File
@@ -8,16 +8,20 @@
// </auto-generated>
//------------------------------------------------------------------------------
using System.CodeDom.Compiler;
using System.Configuration;
using System.Runtime.CompilerServices;
namespace ProductionUiCordonel.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
[CompilerGenerated()]
[GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
private static Settings defaultInstance = ((Settings)(Synchronized(new Settings())));
public static Settings Default
{
@@ -9,7 +9,7 @@
<Grid Margin="0,0,0,0">
<Label Content="" HorizontalAlignment="Left" Height="7" VerticalAlignment="Top" Width="264" Margin="10,0,0,0"/>
<Label Name="lblDescription" Content="" Margin="17,53,0,0" HorizontalAlignment="Left" Width="423" Height="237" VerticalAlignment="Top"/>
<Label Content="Scanner Input" Margin="0,0,334,259" RenderTransformOrigin="0.5,0.5" MaxHeight="25" FontSize="10" Height="29" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="83" />
<Label Content="Scanner Input" Margin="0,0,334,259" RenderTransformOrigin="0.5,0.5" MaxHeight="25" FontSize="12" Height="29" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="83" />
<Label Name="lblInput" Background="Beige" Content="" Margin="0,0,161,259" FontSize="10" MaxHeight="25" MouseDown="LblInput_MouseDown" Height="24" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="168"/>
<TextBox Name="txtHiddenInput" KeyDown="txtHiddenInput_KeyDown" Margin="118,29,125,25" Width="0" >
@@ -12,7 +12,7 @@ namespace ProductionUiCordonel.UserControls.FinalTest
public partial class UcBarcodeInput : UserControl
{
public event EventHandler<string> BarcodeInput;
public event EventHandler<String> BarcodeInput;
public UcBarcodeInput()
{
@@ -21,15 +21,15 @@ namespace ProductionUiCordonel.UserControls.FinalTest
public class DialogOption
{
public DialogOption(string headLine, string desc, Action selectedAction)
public DialogOption(String headLine, String desc, Action selectedAction)
{
HeadLine = headLine;
Desc = desc;
SelectedAction = selectedAction;
}
private Action SelectedAction;
private string HeadLine = "Hl";
private string Desc = "descr";
private String HeadLine = "Hl";
private String Desc = "descr";
public UIElement GeneratBtn()
{
var btn = new Button();
@@ -51,7 +51,7 @@ namespace ProductionUiCordonel.UserControls.FinalTest
}
internal void SetDesc(string v)
internal void SetDesc(String v)
{
lblDescription.Dispatcher.Invoke(DispatcherPriority.Send,
new Action(() =>
@@ -66,7 +66,7 @@ namespace ProductionUiCordonel.UserControls.FinalTest
internal void SetFocusMe()
{
this.Dispatcher.Invoke(DispatcherPriority.Send,
Dispatcher.Invoke(DispatcherPriority.Send,
new Action(() =>
{
txtHiddenInput.Focus();
@@ -74,9 +74,9 @@ namespace ProductionUiCordonel.UserControls.FinalTest
));
}
public void inputKey(string input)
public void inputKey(String input)
{
this.Dispatcher.Invoke(DispatcherPriority.Send,
Dispatcher.Invoke(DispatcherPriority.Send,
new Action(() =>
{
BarcodeInput?.Invoke(this,input);
@@ -84,7 +84,7 @@ namespace ProductionUiCordonel.UserControls.FinalTest
));
}
private void txtHiddenInput_KeyDown(object sender, KeyEventArgs e)
private void txtHiddenInput_KeyDown(Object sender, KeyEventArgs e)
{
//if (e.Key == Key.Enter)
//{
@@ -99,9 +99,9 @@ namespace ProductionUiCordonel.UserControls.FinalTest
}
private void UserControl_MouseDown(object sender, MouseButtonEventArgs e)
private void UserControl_MouseDown(Object sender, MouseButtonEventArgs e)
{
this.Dispatcher.Invoke(DispatcherPriority.Send,
Dispatcher.Invoke(DispatcherPriority.Send,
new Action(() =>
{
//txtHiddenInput.Focus();
@@ -109,9 +109,9 @@ namespace ProductionUiCordonel.UserControls.FinalTest
));
}
private void LblInput_MouseDown(object sender, MouseButtonEventArgs e)
private void LblInput_MouseDown(Object sender, MouseButtonEventArgs e)
{
this.Dispatcher.Invoke(DispatcherPriority.Send,
Dispatcher.Invoke(DispatcherPriority.Send,
new Action(() =>
{
//txtHiddenInput.Focus();
@@ -1,18 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
namespace ProductionUiCordonel.UserControls.FinalTest
@@ -29,15 +18,15 @@ namespace ProductionUiCordonel.UserControls.FinalTest
public class DialogOption
{
public DialogOption(string headLine, string desc, Action selectedAction)
public DialogOption(String headLine, String desc, Action selectedAction)
{
HeadLine = headLine;
Desc = desc;
SelectedAction = selectedAction;
}
private Action SelectedAction;
private string HeadLine = "Hl";
private string Desc = "descr";
private String HeadLine = "Hl";
private String Desc = "descr";
public UIElement GeneratBtn()
{
var btn = new Button();
@@ -59,7 +48,7 @@ namespace ProductionUiCordonel.UserControls.FinalTest
}
internal void SetDesc(string v)
internal void SetDesc(String v)
{
lblDescription.Dispatcher.Invoke(DispatcherPriority.Send,
new Action(() =>
@@ -87,7 +76,7 @@ namespace ProductionUiCordonel.UserControls.FinalTest
this.Dispatcher.Invoke(DispatcherPriority.Send,
Dispatcher.Invoke(DispatcherPriority.Send,
new Action(() =>
{
var stackPnl = new StackPanel();
@@ -1,17 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Controls;
namespace ProductionUiCordonel.UserControls.FinalTest
{
@@ -1,17 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Controls;
namespace ProductionUiCordonel.UserControls.FinalTest
{
@@ -2,12 +2,11 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ProductionUiCordonel.UserControls.FinalTest"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="260" d:DesignWidth="350">
<Grid>
<Label Name="lblHl" Content="ReadOut" HorizontalAlignment="Left" Height="60" VerticalAlignment="Top" Width="340" FontSize="10"/>
<Label Name="lblText" HorizontalAlignment="Left" Height="56" Margin="1,109,0,0" VerticalAlignment="Top" Width="339" FontSize="8"/>
<Label Name="lblHl" Content="ReadOut" HorizontalAlignment="Left" Height="60" VerticalAlignment="Top" Width="340" FontSize="12"/>
<Label Name="lblText" HorizontalAlignment="Left" Height="56" Margin="1,109,0,0" VerticalAlignment="Top" Width="339" FontSize="12"/>
</Grid>
</UserControl>
@@ -1,17 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Controls;
namespace ProductionUiCordonel.UserControls.FinalTest
{
@@ -1,52 +1,38 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net.Http;
using System.Text;
using System;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using Xylem.Common.CommonCore.Configuration;
using Color = System.Drawing.Color;
namespace ProductionUiCordonel.UserControls.FinalTest
{
/// <summary>
/// Interaction logic for UcRadioCheck.xaml
/// </summary>
public partial class UcRadioCheck : UserControl
public partial class UcRadioCheck
{
public class UIContainerElement
{
public int? Value = null;
public System.Drawing.Color Color;
public Int32? Value;
public Color Color;
public UIContainerElement(int? value)
public UIContainerElement(Int32? value)
{
Value = value;
if (!value.HasValue)
{
Color = System.Drawing.Color.LightYellow;
Color = Color.LightYellow;
}
else
{
Color = System.Drawing.Color.Transparent;
Color = Color.Transparent;
}
}
public string GetText()
public String GetText()
{
return Value.HasValue ? Value.Value.ToString() : "-";
}
@@ -63,7 +49,7 @@ namespace ProductionUiCordonel.UserControls.FinalTest
public UIContainerElement CordMax;
public UIContainerElement SirtMax;
public UIContainer(int? cordMin = null, int? sirtMin = null, int? cordRssi = null, int? sirtRssi = null, int? cordMax = null, int? sirtMax = null)
public UIContainer(Int32? cordMin = null, Int32? sirtMin = null, Int32? cordRssi = null, Int32? sirtRssi = null, Int32? cordMax = null, Int32? sirtMax = null)
{
CordMin = new UIContainerElement(cordMin);
SirtMin = new UIContainerElement(sirtMin);
@@ -75,40 +61,40 @@ namespace ProductionUiCordonel.UserControls.FinalTest
//only when results from semi are prensent
if (CordRssi.Value.HasValue && SirtRssi.Value.HasValue)
{
bool success = true;
Boolean success = true;
if (!CordMin.Value.HasValue || CordRssi.Value.Value < CordMin.Value.Value)
{
success = false;
CordMin.Color = System.Drawing.Color.Tomato;
CordRssi.Color = System.Drawing.Color.White;
CordMin.Color = Color.Tomato;
CordRssi.Color = Color.White;
}
if (!SirtMin.Value.HasValue || SirtRssi.Value.Value < SirtMin.Value.Value)
{
success = false;
SirtMin.Color = System.Drawing.Color.Tomato;
SirtRssi.Color = System.Drawing.Color.White;
SirtMin.Color = Color.Tomato;
SirtRssi.Color = Color.White;
}
if (!CordMax.Value.HasValue || CordRssi.Value.Value > CordMax.Value.Value)
{
success = false;
CordMax.Color = System.Drawing.Color.Tomato;
CordRssi.Color = System.Drawing.Color.White;
CordMax.Color = Color.Tomato;
CordRssi.Color = Color.White;
}
if (!SirtMax.Value.HasValue || SirtRssi.Value.Value > SirtMax.Value.Value)
{
success = false;
SirtMax.Color = System.Drawing.Color.Tomato;
SirtRssi.Color = System.Drawing.Color.White;
SirtMax.Color = Color.Tomato;
SirtRssi.Color = Color.White;
}
if (success)
{
CordRssi.Color = System.Drawing.Color.LightGreen;
SirtRssi.Color = System.Drawing.Color.LightGreen;
CordRssi.Color = Color.LightGreen;
SirtRssi.Color = Color.LightGreen;
}
}
@@ -120,7 +106,7 @@ namespace ProductionUiCordonel.UserControls.FinalTest
public void SetUi(UIContainer uiContainer)
{
this.Dispatcher.Invoke(DispatcherPriority.Send,
Dispatcher.Invoke(DispatcherPriority.Send,
new Action(() =>
{
setLbl(lblCordMin, uiContainer.CordMin);
@@ -137,7 +123,7 @@ namespace ProductionUiCordonel.UserControls.FinalTest
{
lbl.Content = element.GetText();
lbl.Background =
new SolidColorBrush(Color.FromArgb(element.Color.A, element.Color.R, element.Color.G, element.Color.B));
new SolidColorBrush(System.Windows.Media.Color.FromArgb(element.Color.A, element.Color.R, element.Color.G, element.Color.B));
}
@@ -151,17 +137,17 @@ namespace ProductionUiCordonel.UserControls.FinalTest
InitializeComponent();
}
private void btnReset_Click(object sender, RoutedEventArgs e)
private void btnReset_Click(Object sender, RoutedEventArgs e)
{
Task.Run(() => { OnResetRequested?.Invoke(sender, e); });
}
private void Button_Click(object sender, RoutedEventArgs e)
private void Button_Click(Object sender, RoutedEventArgs e)
{
Task.Run(() => { OnRetryRequested?.Invoke(sender, e); });
}
internal void ViewResult(int WaitSeconds = 10)
internal void ViewResult(Int32 WaitSeconds = 10)
{
@@ -174,8 +160,9 @@ namespace ProductionUiCordonel.UserControls.FinalTest
var waitMS = WaitSeconds * 1000;
while (waitMS > 0)
{
var ms = waitMS;
BtnDone.Dispatcher.Invoke(DispatcherPriority.Send,
new Action(() => { BtnDone.Content = $"Done({waitMS / 1000}s)"; }
new Action(() => { BtnDone.Content = $"Done({ms / 1000}s)"; }
));
waitMS = waitMS - 1000;
@@ -183,24 +170,24 @@ namespace ProductionUiCordonel.UserControls.FinalTest
}
BtnDone.Dispatcher.Invoke(DispatcherPriority.Send,
new Action(() => { BtnDone.Content = $"Done"; }
new Action(() => { BtnDone.Content = "Done"; }
));
OnDoneRequested?.Invoke(this, EventArgs.Empty);
});
}
private void BtnDone_Click(object sender, RoutedEventArgs e)
private void BtnDone_Click(Object sender, RoutedEventArgs e)
{
Task.Run(() => { OnDoneRequested?.Invoke(sender, e); });
BtnDone.IsEnabled = false;
}
private void BtnDone_Copy_Click(object sender, RoutedEventArgs e)
private void BtnDone_Copy_Click(Object sender, RoutedEventArgs e)
{
Task.Run(() => { OnDoneRequested?.Invoke(sender, e); });
}
private void BtnfrocePam_Click(object sender, RoutedEventArgs e)
private void BtnfrocePam_Click(Object sender, RoutedEventArgs e)
{
Task.Run(() => { OnForceAPam?.Invoke(sender, e); });
}
@@ -1,7 +1,9 @@
using ProductionUiCordonel.Model;
using System;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using ProductionUiCordonel.Model;
using MessageBox = System.Windows.Forms.MessageBox;
namespace ProductionUiCordonel.ctls
{
@@ -10,7 +12,7 @@ namespace ProductionUiCordonel.ctls
/// </summary>
public partial class ctlMultiModeMarriage : UserControl
{
private MarriageMultiModeViewModel ViewModel = null;
private MarriageMultiModeViewModel ViewModel;
public ctlMultiModeMarriage()
{
InitializeComponent();
@@ -22,20 +24,20 @@ namespace ProductionUiCordonel.ctls
//ViewModel.Store();
}
private void btnMarry_Click(object sender, RoutedEventArgs e)
private void btnMarry_Click(Object sender, RoutedEventArgs e)
{
Task<bool>.Run(() =>
Task<Boolean>.Run(() =>
{
return ViewModel.Store();
}).ContinueWith(a =>
{
if (a.Result)
{
System.Windows.Forms.MessageBox.Show("Meter has passed");
MessageBox.Show("Meter has passed");
}
else
{
System.Windows.Forms.MessageBox.Show("Meter not has passed");
MessageBox.Show("Meter not has passed");
}
});
@@ -1,18 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using ProductionUiCordonel.Data;
using ProductionUiCordonel.Model;
@@ -24,7 +13,7 @@ namespace ProductionUiCordonel.ctls
/// </summary>
public partial class ctlMultiModePicking : UserControl
{
private PickingMultiModeViewModel ViewModel = null;
private PickingMultiModeViewModel ViewModel;
public ctlMultiModePicking()
{
InitializeComponent();
@@ -39,12 +28,12 @@ namespace ProductionUiCordonel.ctls
ViewModel.OnUpdateUi += UpdatePickingUi;
}
private void ViewModel_MeterDetectedHandler(object sender, EventArgs e)
private void ViewModel_MeterDetectedHandler(Object sender, EventArgs e)
{
Dispatcher.Invoke(DispatcherPriority.Normal,
new Action(() =>
{
bool update = false;
Boolean update = false;
if (sender is null)
{
ViewModel.InputIsEnabled = false;
@@ -58,7 +47,7 @@ namespace ProductionUiCordonel.ctls
ViewModel.CurrentMeter.WriteRegister("GENESISFLOW_SealDisplay", 0);
ViewModel.CurrentMeter.WriteRegister("POWERMON_WarnFromClamp", (UInt32)473040000);
ViewModel.CurrentMeter.WriteRegister("SYSTEM_CalendarSeconds", Convert.ToInt32(ts.TotalSeconds));
ViewModel.CurrentMeter.SetLcdText(false, new byte[] { 0x12, 0x34 });
ViewModel.CurrentMeter.SetLcdText(false, new Byte[] { 0x12, 0x34 });
//ViewModel.ReloadData(false);
@@ -67,7 +56,7 @@ namespace ProductionUiCordonel.ctls
));
}
private void UpdatePickingUi(object sender, EventArgs e)
private void UpdatePickingUi(Object sender, EventArgs e)
{
icPicking.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
{
@@ -84,7 +73,7 @@ namespace ProductionUiCordonel.ctls
}
private void PickingData_OnDataChanged(object sender, EventArgs e)
private void PickingData_OnDataChanged(Object sender, EventArgs e)
{
if (sender is ObservableCollection<IPickingResultData> newData)
{
@@ -1,11 +1,10 @@
using ProductionUiCordonel.Event;
using ProductionUiCordonel.Model;
using System;
using System;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Threading;
using ProductionUiCordonel.Event;
using ProductionUiCordonel.Model;
using Xylem.Common.Logic.ProductionOrderCore.TestResults;
namespace ProductionUiCordonel.ctls
@@ -17,7 +16,7 @@ namespace ProductionUiCordonel.ctls
{
public event EventHandler<StringArgs> OnBarcodeInput;
private PressureMultiModeViewModel ViewModel = null;
private PressureMultiModeViewModel ViewModel;
public ctlMultiModePressure()
{
InitializeComponent();
@@ -48,12 +47,12 @@ namespace ProductionUiCordonel.ctls
private void ViewModel_MeterDetectedHandler(object sender, EventArgs e)
private void ViewModel_MeterDetectedHandler(Object sender, EventArgs e)
{
Dispatcher.Invoke(DispatcherPriority.Normal,
new Action(() =>
{
bool update = false;
Boolean update = false;
if (sender is null)
{
ViewModel.InputIsEnabled = false;
@@ -66,23 +65,23 @@ namespace ProductionUiCordonel.ctls
));
}
private void BtnPresueOk_Click(object sender, RoutedEventArgs e)
private void BtnPresueOk_Click(Object sender, RoutedEventArgs e)
{
ViewModel.StoreData(true);
}
private void BtnPresueFailed_Click(object sender, RoutedEventArgs e)
private void BtnPresueFailed_Click(Object sender, RoutedEventArgs e)
{
ViewModel.StoreData(false);
}
private void ViewModel_OnStoreDone(object sender, StringArgs e)
private void ViewModel_OnStoreDone(Object sender, StringArgs e)
{
MessageBox.Show(e.Content);
}
private int? BarcodeInputActiveOffset = null;
private string BarcodeInput = "";
private Int32? BarcodeInputActiveOffset;
private String BarcodeInput = "";
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
private void TextBox_TextChanged(Object sender, TextChangedEventArgs e)
{
if (sender is TextBox txtSender)
{
@@ -94,7 +93,7 @@ namespace ProductionUiCordonel.ctls
{
BarcodeInput = $"{BarcodeInput}{input}";
if (input == System.Environment.NewLine)
if (input == Environment.NewLine)
{
var tmpOffset = BarcodeInputActiveOffset.Value;
BarcodeInputActiveOffset = null;
@@ -120,9 +119,9 @@ namespace ProductionUiCordonel.ctls
}
private void Button_Click(object sender, RoutedEventArgs e)
private void Button_Click(Object sender, RoutedEventArgs e)
{
string input = "";
String input = "";
var obj = ((FrameworkElement)sender).DataContext;
if (obj is PressureTestPoints ptp)
{
+15 -1
View File
@@ -107,6 +107,7 @@
this.cbxFilterFWType = new System.Windows.Forms.ComboBox();
this.chbFilterIsDeveloper = new System.Windows.Forms.CheckBox();
this.saveConfigFile = new System.Windows.Forms.SaveFileDialog();
this.cbxMetUpdPerm = new System.Windows.Forms.CheckBox();
this.grpSetup.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox4.SuspendLayout();
@@ -210,6 +211,7 @@
//
// groupBox2
//
this.groupBox2.Controls.Add(this.cbxMetUpdPerm);
this.groupBox2.Controls.Add(this.btnRebootMeter);
this.groupBox2.Controls.Add(this.groupBox4);
this.groupBox2.Controls.Add(this.lblUpdateTime);
@@ -622,7 +624,7 @@
//
// tmrProgressUpdate
//
this.tmrProgressUpdate.Interval = 200;
this.tmrProgressUpdate.Interval = 250;
this.tmrProgressUpdate.Tick += new System.EventHandler(this.tmrProgressUpdate_Tick);
//
// dlgOpenPackageFile
@@ -962,6 +964,17 @@
//
this.saveConfigFile.Filter = "configuration file (*.hex)|*.hex";
//
// cbxMetUpdPerm
//
this.cbxMetUpdPerm.AutoSize = true;
this.cbxMetUpdPerm.Enabled = false;
this.cbxMetUpdPerm.Location = new System.Drawing.Point(955, 310);
this.cbxMetUpdPerm.Name = "cbxMetUpdPerm";
this.cbxMetUpdPerm.Size = new System.Drawing.Size(110, 17);
this.cbxMetUpdPerm.TabIndex = 24;
this.cbxMetUpdPerm.Text = "Metrology Update";
this.cbxMetUpdPerm.UseVisualStyleBackColor = true;
//
// FrmFwUpdate
//
this.AccessibleRole = System.Windows.Forms.AccessibleRole.Sound;
@@ -1088,5 +1101,6 @@
private System.Windows.Forms.CheckBox cbxStoreConfigEnable;
private System.Windows.Forms.SaveFileDialog saveConfigFile;
private System.Windows.Forms.Button btnRebootMeter;
private System.Windows.Forms.CheckBox cbxMetUpdPerm;
}
}
+23 -10
View File
@@ -145,6 +145,9 @@ namespace Xylem.Common.Ui.GenesisToolBox
/// <summary>
/// Clear data table and set genesis to not connected
/// </summary>
/// <remarks date="2023-Jan-18" author="Thomas Wiedebusch">
/// - Enable update of Genesis Flow in Genesis Tool Box.
/// </remarks>
private void Init()
{
ProcessViewControl(false);
@@ -1176,6 +1179,8 @@ namespace Xylem.Common.Ui.GenesisToolBox
barSingleProgressUpdate.Update();
}
SetTimeDisplay();
if (_currentGenesis != null)
cbxMetUpdPerm.Checked = (_currentGenesis.MetrologyUpgradePermission & 0xFF) == 0xFF;
Update();
}
@@ -1198,6 +1203,9 @@ namespace Xylem.Common.Ui.GenesisToolBox
}
/// <remarks date="2023-Jan-18" author="Thomas Wiedebusch">
/// - Enable update of Genesis Flow in Genesis Tool Box.
/// </remarks>
private void btnOpenPackageControlFile_Click(Object sender, EventArgs e)
{
//reload last path
@@ -1220,7 +1228,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
tbxPackageFilePathName.Text = packageFilePathName;
if (_meterFwUpdate == null)
{
_meterFwUpdate = new MeterFwUpdate(_currentGenesis);
_meterFwUpdate = new MeterFwUpdate(_currentGenesis, true);
}
if (_meterFwUpdate == null)
@@ -1261,7 +1269,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
tbxBinaryPath.Text = binaryFilePath;
var meterFwUpdate = new MeterFwUpdate(_currentGenesis);
var meterFwUpdate = new MeterFwUpdate(_currentGenesis, true);
if (meterFwUpdate.LoadFileApps(binaryFilePath))
{
lblFileAppsLoadedInfo.ForeColor = Color.Green;
@@ -1583,6 +1591,9 @@ namespace Xylem.Common.Ui.GenesisToolBox
/// <param name="binaryPath"></param>
/// <param name="packageInfoPath"></param>
/// <returns></returns>
/// <remarks date="2023-Jan-18" author="Thomas Wiedebusch">
/// - Enable update of Genesis Flow in Genesis Tool Box.
/// </remarks>
public Boolean Prepare(Int32 slot, String binaryPath, String packageInfoPath)
{
_updateGui = false;
@@ -1604,7 +1615,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
tbxBinaryPath.Text = binaryPath;
if (_meterFwUpdate == null)
{
_meterFwUpdate = new MeterFwUpdate(_currentGenesis);
_meterFwUpdate = new MeterFwUpdate(_currentGenesis, true);
}
if (_meterFwUpdate == null)
@@ -1638,7 +1649,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
tbxPackageFilePathName.Text = packageInfoPath;
if (_meterFwUpdate == null)
{
_meterFwUpdate = new MeterFwUpdate(_currentGenesis);
_meterFwUpdate = new MeterFwUpdate(_currentGenesis, true);
}
if (_meterFwUpdate == null)
@@ -1803,14 +1814,14 @@ namespace Xylem.Common.Ui.GenesisToolBox
if (cbxFilterFwDn.SelectedItem.ToString() != "ALL")
{
var myMeterSize = ((MeterSize)cbxFilterFwDn.SelectedItem).GetHashCode();
url = url + $"&CordonelFwFile_Dn={myMeterSize}";
url += $"&CordonelFwFile_Dn={myMeterSize}";
}
if (cbxFilterFWType.SelectedItem.ToString() != "ALL")
{
var fwTypeEnum = ((CordonelFWTypeEnum)cbxFilterFWType.SelectedItem).GetHashCode();
url = url + $"&CordonelFwFile_Type={fwTypeEnum}";
url += $"&CordonelFwFile_Type={fwTypeEnum}";
}
url = url + $"&FileCategoryID=1";
url += "&FileCategoryID=1";
var result = LocalWebRequest.GetRequest(url, 1000);
@@ -1818,14 +1829,16 @@ namespace Xylem.Common.Ui.GenesisToolBox
dgvFiles.DataSource = a.OrderByDescending(o => o.FileDate).ToList();
for (Int32 i = 0; i < dgvFiles.ColumnCount; i++)
for (var i = 0; i < dgvFiles.ColumnCount; i++)
{
dgvFiles.Columns[i].Visible = i < 5;
}
dgvFiles.AutoResizeColumns();
}
/// <remarks date="2023-Jan-18" author="Thomas Wiedebusch">
/// - Enable update of Genesis Flow in Genesis Tool Box.
/// </remarks>
private void dgvFiles_CellContentClick(Object sender, DataGridViewCellEventArgs e)
{
@@ -1839,7 +1852,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
lblFwNameSelected.Text = dgvFiles.Rows[e.RowIndex].Cells[1].Value.ToString();
lblSelectedID.Text = parentFilId.ToString();
_meterFwUpdate = new MeterFwUpdate(_currentGenesis);
_meterFwUpdate = new MeterFwUpdate(_currentGenesis, true);
var fileApps = new List<FileApplications>();
@@ -132,6 +132,12 @@
<metadata name="tabDb.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tabProduction.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tabDb.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="saveConfigFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>465, 17</value>
</metadata>
+85 -10
View File
@@ -57,6 +57,7 @@
this.lblFwUpdateInfo = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnTidyFile = new System.Windows.Forms.Button();
this.btnGetDateTime = new System.Windows.Forms.Button();
this.btnSetDateTime = new System.Windows.Forms.Button();
this.btnRebootMeter = new System.Windows.Forms.Button();
@@ -70,11 +71,17 @@
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.btnListFileDetails = new System.Windows.Forms.Button();
this.btnReadLogFiles = new System.Windows.Forms.Button();
this.btnTidyFile = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label4 = new System.Windows.Forms.Label();
this.tbxFileToEraseName = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.tbxFileToEraseDrive = new System.Windows.Forms.TextBox();
this.btnEraseFile = new System.Windows.Forms.Button();
this.grpSetup.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// grpSetup
@@ -363,6 +370,16 @@
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Tools";
//
// btnTidyFile
//
this.btnTidyFile.Location = new System.Drawing.Point(10, 174);
this.btnTidyFile.Name = "btnTidyFile";
this.btnTidyFile.Size = new System.Drawing.Size(116, 25);
this.btnTidyFile.TabIndex = 39;
this.btnTidyFile.Text = "Tidy File System";
this.btnTidyFile.UseVisualStyleBackColor = true;
this.btnTidyFile.Click += new System.EventHandler(this.btnTidyFile_Click);
//
// btnGetDateTime
//
this.btnGetDateTime.Location = new System.Drawing.Point(10, 144);
@@ -462,7 +479,7 @@
this.groupBox2.Controls.Add(this.btnUploadConfig);
this.groupBox2.Location = new System.Drawing.Point(417, 69);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(136, 273);
this.groupBox2.Size = new System.Drawing.Size(136, 123);
this.groupBox2.TabIndex = 37;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Log";
@@ -487,15 +504,64 @@
this.btnReadLogFiles.UseVisualStyleBackColor = true;
this.btnReadLogFiles.Click += new System.EventHandler(this.btnReadLogFiles_Click);
//
// btnTidyFile
// groupBox3
//
this.btnTidyFile.Location = new System.Drawing.Point(10, 174);
this.btnTidyFile.Name = "btnTidyFile";
this.btnTidyFile.Size = new System.Drawing.Size(116, 25);
this.btnTidyFile.TabIndex = 39;
this.btnTidyFile.Text = "Tidy File System";
this.btnTidyFile.UseVisualStyleBackColor = true;
this.btnTidyFile.Click += new System.EventHandler(this.btnTidyFile_Click);
this.groupBox3.Controls.Add(this.label4);
this.groupBox3.Controls.Add(this.tbxFileToEraseName);
this.groupBox3.Controls.Add(this.label3);
this.groupBox3.Controls.Add(this.tbxFileToEraseDrive);
this.groupBox3.Controls.Add(this.btnEraseFile);
this.groupBox3.Location = new System.Drawing.Point(559, 69);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(136, 123);
this.groupBox3.TabIndex = 40;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Erase Files";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(10, 60);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(38, 13);
this.label4.TabIndex = 40;
this.label4.Text = "Name:";
//
// tbxFileToEraseName
//
this.tbxFileToEraseName.Location = new System.Drawing.Point(50, 57);
this.tbxFileToEraseName.Name = "tbxFileToEraseName";
this.tbxFileToEraseName.Size = new System.Drawing.Size(76, 20);
this.tbxFileToEraseName.TabIndex = 41;
this.tbxFileToEraseName.Text = "tstfile";
this.tbxFileToEraseName.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbxFileToEraseName_KeyDown);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(10, 30);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(35, 13);
this.label3.TabIndex = 39;
this.label3.Text = "Drive:";
//
// tbxFileToEraseDrive
//
this.tbxFileToEraseDrive.Location = new System.Drawing.Point(50, 27);
this.tbxFileToEraseDrive.Name = "tbxFileToEraseDrive";
this.tbxFileToEraseDrive.Size = new System.Drawing.Size(76, 20);
this.tbxFileToEraseDrive.TabIndex = 39;
this.tbxFileToEraseDrive.Text = "1";
//
// btnEraseFile
//
this.btnEraseFile.Location = new System.Drawing.Point(10, 84);
this.btnEraseFile.Name = "btnEraseFile";
this.btnEraseFile.Size = new System.Drawing.Size(116, 25);
this.btnEraseFile.TabIndex = 39;
this.btnEraseFile.Text = "Erase File";
this.btnEraseFile.UseVisualStyleBackColor = true;
this.btnEraseFile.Click += new System.EventHandler(this.btnEraseFile_Click);
//
// FrmLowLevelTools
//
@@ -503,6 +569,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(723, 432);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.label7);
this.Controls.Add(this.lblUpdateTime);
@@ -532,6 +599,8 @@
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -581,5 +650,11 @@
private System.Windows.Forms.Button btnReadLogFiles;
private System.Windows.Forms.Button btnListFileDetails;
private System.Windows.Forms.Button btnTidyFile;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox tbxFileToEraseDrive;
private System.Windows.Forms.Button btnEraseFile;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox tbxFileToEraseName;
}
}
+68 -1
View File
@@ -8,6 +8,7 @@ using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Input;
using Logic.ProductionToProductMapper.Cordonel;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@@ -157,6 +158,9 @@ namespace Xylem.Common.Ui.GenesisToolBox
btnReadLogFiles.Enabled = false;
btnListFileDetails.Enabled = false;
btnTidyFile.Enabled = false;
btnEraseFile.Enabled = false;
tbxFileToEraseName.Enabled = false;
tbxFileToEraseDrive.Enabled = false;
}
/// <summary>
@@ -174,6 +178,9 @@ namespace Xylem.Common.Ui.GenesisToolBox
btnReadLogFiles.Enabled = true;
btnListFileDetails.Enabled = true;
btnTidyFile.Enabled = true;
btnEraseFile.Enabled = true;
tbxFileToEraseName.Enabled = true;
tbxFileToEraseDrive.Enabled = true;
}
/// <summary>
@@ -1372,7 +1379,8 @@ namespace Xylem.Common.Ui.GenesisToolBox
? $@"File {fileToErase} successfully erased"
: $@"File {fileToErase} erasure failed");
if (success) continue;
if (success)
continue;
_currentGenesis.Logout();
_currentGenesis.ReLogin();
}
@@ -1391,6 +1399,65 @@ namespace Xylem.Common.Ui.GenesisToolBox
});
}
/// <summary>
/// Erase a specified file
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <remarks date="2022-Dec-20" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
private void btnEraseFile_Click(Object sender, EventArgs e)
{
if (_currentGenesis == null)
return;
if (_meterFile == null)
_meterFile = new MeterFile(_currentGenesis);
//reset timer
_startTime = DateTimeOffset.UtcNow;
LowLevelActionControl(true);
var file = $@"{tbxFileToEraseDrive.Text}\{tbxFileToEraseName.Text}";
var msg = $@"Erase file {file}";
LogText(msg);
lblOverall.Text = msg;
Task.Factory.StartNew(() =>
{
_currentGenesis.ReLogin();
// erase files
_meterFile.UnlockEraseWriteMeterFile(file);
var success = _meterFile.EraseMeterFile(file);
LogText(success
? $@"File {file} successfully erased"
: $@"File {file} erasure failed");
// catalogue after cleaning
SetActualProcessAndLog(@"List meter files");
ListMeterFiles();
}).ContinueWith(delegate
{
//add a blank line to separate next operation
LogText("");
_currentGenesis.Logout();
LowLevelActionControl(false);
Invoke(new Action(() => { tbxFileToEraseName.Focus(); }));
});
}
private void tbxFileToEraseName_KeyDown(Object sender, System.Windows.Forms.KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
btnEraseFile_Click(this, null);
}
}
#endregion
}
}
+11 -11
View File
@@ -30,6 +30,7 @@
{
this.components = new System.ComponentModel.Container();
this.grpSetup = new System.Windows.Forms.GroupBox();
this.btnClearDisplay = new System.Windows.Forms.Button();
this.label10 = new System.Windows.Forms.Label();
this.tbxRadio = new System.Windows.Forms.TextBox();
this.tbxRegion = new System.Windows.Forms.TextBox();
@@ -76,7 +77,6 @@
this.label9 = new System.Windows.Forms.Label();
this.lblUpdateTime = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.btnClearDisplay = new System.Windows.Forms.Button();
this.grpSetup.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.groupBox1.SuspendLayout();
@@ -107,6 +107,16 @@
this.grpSetup.TabStop = false;
this.grpSetup.Text = "Cordonel";
//
// btnClearDisplay
//
this.btnClearDisplay.Location = new System.Drawing.Point(128, 239);
this.btnClearDisplay.Name = "btnClearDisplay";
this.btnClearDisplay.Size = new System.Drawing.Size(116, 25);
this.btnClearDisplay.TabIndex = 33;
this.btnClearDisplay.Text = "Release Display";
this.btnClearDisplay.UseVisualStyleBackColor = true;
this.btnClearDisplay.Click += new System.EventHandler(this.btnClearDisplay_Click);
//
// label10
//
this.label10.AutoSize = true;
@@ -557,16 +567,6 @@
this.label7.TabIndex = 32;
this.label7.Text = "Cordonel LUT Update";
//
// btnClearDisplay
//
this.btnClearDisplay.Location = new System.Drawing.Point(128, 239);
this.btnClearDisplay.Name = "btnClearDisplay";
this.btnClearDisplay.Size = new System.Drawing.Size(116, 25);
this.btnClearDisplay.TabIndex = 33;
this.btnClearDisplay.Text = "Clear Display";
this.btnClearDisplay.UseVisualStyleBackColor = true;
this.btnClearDisplay.Click += new System.EventHandler(this.btnClearDisplay_Click);
//
// FrmLutUpdate
//
this.AccessibleRole = System.Windows.Forms.AccessibleRole.Sound;
+9 -4
View File
@@ -286,6 +286,8 @@ namespace Xylem.Common.Ui.GenesisToolBox
{
_tryConnectPcb = false;
ProcessViewControl(false);
btnClearDisplay.Enabled = true;
}));
}
}
@@ -345,6 +347,12 @@ namespace Xylem.Common.Ui.GenesisToolBox
ProcessViewControl(false);
SetControlsDownloadIsFinished();
// update the display of the meter size, LUT CRC and region
tbxMeterFw.Text = _currentGenesis.FwVersion;
tbxMeterMeterSize.Text = _currentGenesis.MeterSize;
tbxMeterLutCrc.Text = _currentGenesis.LutCrc;
tbxRegion.Text = _currentGenesis.Region;
if (!_lutFileSuccessfulWritten)
{
lblLutFileLoadedInfo.ForeColor = Color.Red;
@@ -362,10 +370,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
}
else
{
// on successfully execution the meter size and LUT CRC is identical to file content
tbxMeterMeterSize.Text = tbxFileMeterSize.Text;
tbxMeterLutCrc.Text = tbxFileCrc.Text;
LogSuccessText(StrUpdateSuccessMessage);
LogSuccessText(StrUpdateSuccessMessage);
MessageBoxShow(StrUpdateSuccessMessage, @"SUCCESS",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
+13 -13
View File
@@ -40,12 +40,12 @@
this.btnAlarm = new System.Windows.Forms.Button();
this.btnSetup = new System.Windows.Forms.Button();
this.gpLAA = new System.Windows.Forms.GroupBox();
this.btnLowLevelTools = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.btnPara = new System.Windows.Forms.Button();
this.btnRegHistory = new System.Windows.Forms.Button();
this.btnPassword = new System.Windows.Forms.Button();
this.btnLowLevelTools = new System.Windows.Forms.Button();
this.gbDeveloper = new System.Windows.Forms.GroupBox();
this.BtnFileSplit = new System.Windows.Forms.Button();
this.btnFiles = new System.Windows.Forms.Button();
@@ -102,7 +102,7 @@
this.btnLutUpdate.Name = "btnLutUpdate";
this.btnLutUpdate.Size = new System.Drawing.Size(151, 39);
this.btnLutUpdate.TabIndex = 17;
this.btnLutUpdate.Text = "Metrology LUT";
this.btnLutUpdate.Text = "LUT Update";
this.btnLutUpdate.UseVisualStyleBackColor = true;
this.btnLutUpdate.Click += new System.EventHandler(this.btnLutUpdate_Click);
//
@@ -191,17 +191,6 @@
this.gpLAA.TabStop = false;
this.gpLAA.Text = "Production LAA";
//
// btnLowLevelTools
//
this.btnLowLevelTools.Location = new System.Drawing.Point(4, 167);
this.btnLowLevelTools.Name = "btnLowLevelTools";
this.btnLowLevelTools.Size = new System.Drawing.Size(152, 40);
this.btnLowLevelTools.TabIndex = 22;
this.btnLowLevelTools.Text = "Low Level Tools";
this.btnLowLevelTools.UseMnemonic = false;
this.btnLowLevelTools.UseVisualStyleBackColor = true;
this.btnLowLevelTools.Click += new System.EventHandler(this.btnLog_Click);
//
// button5
//
this.button5.Location = new System.Drawing.Point(4, 191);
@@ -256,6 +245,17 @@
this.btnPassword.UseVisualStyleBackColor = true;
this.btnPassword.Click += new System.EventHandler(this.btnPassword_Click);
//
// btnLowLevelTools
//
this.btnLowLevelTools.Location = new System.Drawing.Point(4, 167);
this.btnLowLevelTools.Name = "btnLowLevelTools";
this.btnLowLevelTools.Size = new System.Drawing.Size(152, 40);
this.btnLowLevelTools.TabIndex = 22;
this.btnLowLevelTools.Text = "Low Level Tools";
this.btnLowLevelTools.UseMnemonic = false;
this.btnLowLevelTools.UseVisualStyleBackColor = true;
this.btnLowLevelTools.Click += new System.EventHandler(this.btnLog_Click);
//
// gbDeveloper
//
this.gbDeveloper.Controls.Add(this.btnLowLevelTools);