This commit is contained in:
Roland Drabesch
2025-09-15 16:16:58 +02:00
82 changed files with 738 additions and 3649 deletions
+1 -1
View File
@@ -187,7 +187,7 @@
</site>
<site name="MeterProcessState(3)" id="6">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="E:\REPO\lab\la_operations\laa_production\Common\Service\MeterProcessState" />
<virtualDirectory path="/" physicalPath="C:\Users\SZLATEV\source\repos\laa_production\Common\Service\MeterProcessState" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:50075:localhost" />
+9 -6
View File
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.33423.255
# Visual Studio Version 17
VisualStudioVersion = 17.14.36310.24 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utils", "Utils", "{7A0EE7B8-6B7E-41E9-B679-319C8CA48CF1}"
EndProject
@@ -364,10 +364,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MockGenesis", "Hardware\Wat
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommonConsole", "CommonConsole\CommonConsole.csproj", "{AFC428F5-0141-4A3F-BEF2-470A89D972F6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SIRT", "SIRT", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
Utils\DateTimeServerShared\DateTimeServerShared.projitems*{4806d89a-fbfb-41bc-aaa7-2242444bf55a}*SharedItemsImports = 4
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
_MANUAL_CONTROL|Any CPU = _MANUAL_CONTROL|Any CPU
_MANUAL_CONTROL|Mixed Platforms = _MANUAL_CONTROL|Mixed Platforms
@@ -5865,7 +5864,7 @@ Global
{4E8BB839-D40A-488C-88CE-F21811F1F476} = {43B54F41-6F09-4BCB-9F82-77621275831B}
{56768A27-D0E4-430E-8E75-AFC7319F189A} = {C9393A97-C0BB-4D59-A879-B572BE04CE15}
{E6081C0A-8452-44B4-8EB4-E0CAE9119830} = {56768A27-D0E4-430E-8E75-AFC7319F189A}
{8DE8E742-EE0A-4004-AA49-3D08D748E5AC} = {99B23EE9-CE50-4924-A055-C39EFA038721}
{8DE8E742-EE0A-4004-AA49-3D08D748E5AC} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{FDE234FD-FF24-479F-B5CA-DFB74B4636DA} = {03D4F23E-7E4A-4091-BC96-036C996D351A}
{3332395B-122F-4DE5-A294-9DDAEA09F10C} = {68323534-4337-4E3A-89BC-11D8BB55343A}
{890AA5E6-C55A-4E35-9841-999FA24B5025} = {3332395B-122F-4DE5-A294-9DDAEA09F10C}
@@ -5922,10 +5921,14 @@ Global
{A6B3AB5A-A567-4C77-80FB-1E1E19A00713} = {B5F43F61-4448-4992-85B5-7EDFB82FD643}
{D7A7E1FF-D024-407F-B30D-4C519CFA7BF1} = {A6B3AB5A-A567-4C77-80FB-1E1E19A00713}
{AFC428F5-0141-4A3F-BEF2-470A89D972F6} = {C17363DF-A043-4F25-8EBA-2B3B078227DC}
{02EA681E-C7D8-13C7-8484-4AC65E1B71E8} = {99B23EE9-CE50-4924-A055-C39EFA038721}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4BCB7B69-696C-436A-86F7-C91EA5588164}
EndGlobalSection
GlobalSection(SharedMSBuildProjectFiles) = preSolution
Utils\DateTimeServerShared\DateTimeServerShared.projitems*{4806d89a-fbfb-41bc-aaa7-2242444bf55a}*SharedItemsImports = 4
EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
+4
View File
@@ -47,6 +47,10 @@
IsEncrypted = true
};
task.SetPending();
sirt.Start(task);
task.Wait();
void ResetAlarms(byte alarmMask)
{
if (exitCode != 0)
+86 -63
View File
@@ -1,24 +1,58 @@
using System;
using Common.Hardware.SIRT;
using System;
using System.Linq;
namespace CommonConsole
{
public static class Program
{
//public static int Main(params string[] args)
//{
// var pam03 = new PAM03();
public static void Main2(params string[] args)
{
var pam03 = new PAM03();
// //return pam03.Run("COM7", "412004190", "0E9FACC6A0E1EF1C3B27A49BAC216535");
// pam03.Run("COM6", "402010030", "E6C88800DEB868C0D6A84880CE982840");
pam03.Run("COM6", "402010027", "D9C154DC274966AB71AD5D804A322178");
// try
// {
// return pam03.Run("COM10", "402009768", "3CB64CBCB71F8D0F9F69FF18DF5D24D3");
// }
// catch (System.Exception e)
// {
// return -1;
// }
//}
//return pam03.Run("COM7", "412004190", "0E9FACC6A0E1EF1C3B27A49BAC216535");
// 10402010030 E6C88800DEB868C0D6A84880CE982840
//try
//{
// return pam03.Run("COM10", "402009768", "3CB64CBCB71F8D0F9F69FF18DF5D24D3");
//}
//catch (System.Exception e)
//{
// return -1;
//}
}
internal enum FDRMask
{
LOG_ALARM_STATE = 1 << 0, // 0x00000001, //!< AlarmState (16 bits)
LOG_BILLING_COUNTER = 1 << 1, // 0x00000002, //!< BillingCounter
LOG_REVERSE_COUNTER = 1 << 2, // 0x00000004, //!< Backward or ReverseCounter
LOG_MAX_FLOW_VAL = 1 << 3, // 0x00000008, //!< Value of MaxFlow
LOG_MAX_FLOW_TIME = 1 << 4, // 0x00000010, //!< Date/Time of MaxFlow
LOG_PEAK_FLOW_VAL = 1 << 5, // 0x00000020, //!< Value of PeakFlow
LOG_PEAK_FLOW_TIME = 1 << 6, // 0x00000040, //!< Date/Time of PeakFlow
LOG_CUR_FLOW_VAL = 1 << 7, // 0x00000080, //!< Current Flow Value (Average of Period)
LOG_BROKEN_PIPE_FLOW_VAL = 1 << 8, // 0x00000100, //!< Value of BrokenPipe
LOG_BROKEN_PIPE_FLOW_TIME = 1 << 9, // 0x00000200, //!< Date/Time of BrokenPipe
LOG_MIN_FLOW_VAL = 1 << 10, // 0x00000400, //!< Value of FlowMin
LOG_MIN_FLOW_TIME = 1 << 11, // 0x00000800, //!< Date/Time of FlowMin
LOG_FORWARD_COUNTER = 1 << 12, // 0x00001000, //!< ForwardCounter
LOG_MIN_PRESS_VAL = 1 << 13, // 0x00010000, //!< Pressure Minimum
LOG_MIN_PRESS_TIME = 1 << 14, // 0x00020000, //!< Pressure Minimum Time
LOG_MAX_PRESS_VAL = 1 << 15, // 0x00040000, //!< Pressure Maximum
LOG_MAX_PRESS_TIME = 1 << 16, // 0x00080000, //!< Pressure Maximum Time
LOG_MIN_TEMP_VAL = 1 << 17, // 0x00100000, //!< Temperature Minimum
LOG_MIN_TEMP_TIME = 1 << 18, // 0x00200000, //!< Temperature Minimum
LOG_MAX_TEMP_VAL = 1 << 19, // 0x00400000, //!< Temperature Maximum
LOG_MAX_TEMP_TIME = 1 << 20, // 0x00800000, //!< Temperature Maximum
LOG_CUR_PRESS_VAL = 1 << 21, // 0x01000000, //!< Pressure Current Value
LOG_CUR_TEMP_VAL = 1 << 22, // 0x02000000, //!< Temperature Current Value
LOG_EXT_ALARM_STATE = 1 << 23, // 0x04000000,    //<! Extended Alarm Status
};
internal enum AlarmMask
{
@@ -41,64 +75,53 @@ namespace CommonConsole
ALARM_MAX = 1 << 16
};
internal enum FDRMask
{
LOG_BILLING_COUNTER = 0x00000002, //!< BillingCounter
LOG_FORWARD_COUNTER = 0x00001000, //!< ForwardCounter
LOG_REVERSE_COUNTER = 0x00000004, //!< Backward or ReverseCounter
LOG_MIN_FLOW_TIME = 0x00000800, //!< Date/Time of FlowMin
LOG_MIN_FLOW_VAL = 0x00000400, //!< Value of FlowMin
LOG_BROKEN_PIPE_FLOW_TIME = 0x00000200, //!< Date/Time of BrokenPipe
LOG_BROKEN_PIPE_FLOW_VAL = 0x00000100, //!< Value of BrokenPipe
LOG_CUR_FLOW_VAL = 0x00000080, //!< Current Flow Value (Average of Period)
LOG_PEAK_FLOW_TIME = 0x00000040, //!< Date/Time of PeakFlow
LOG_PEAK_FLOW_VAL = 0x00000020, //!< Value of PeakFlow
LOG_MAX_FLOW_TIME = 0x00000010, //!< Date/Time of MaxFlow
LOG_MAX_FLOW_VAL = 0x00000008, //!< Value of MaxFlow
LOG_CUR_TEMP_VAL = 0x02000000, //!< Temperature Current Value
LOG_MAX_TEMP_TIME = 0x00800000, //!< Temperature Maximum
LOG_MAX_TEMP_VAL = 0x00400000, //!< Temperature Maximum
LOG_MIN_TEMP_TIME = 0x00200000, //!< Temperature Minimum
LOG_MIN_TEMP_VAL = 0x00100000, //!< Temperature Minimum
LOG_CUR_PRESS_VAL = 0x01000000, //!< Pressure Current Value
LOG_MAX_PRESS_TIME = 0x00080000, //!< Pressure Maximum Time
LOG_MAX_PRESS_VAL = 0x00040000, //!< Pressure Maximum
LOG_MIN_PRESS_TIME = 0x00020000, //!< Pressure Minimum Time
LOG_MIN_PRESS_VAL = 0x00010000, //!< Pressure Minimum
LOG_ALARM_STATE = 0x00000001, //!< AlarmState (16 bits)
LOG_EXT_ALARM_STATE = 0x04000000,    //<! Extended Alarm Status
};
public static void Main()
{
Console.WriteLine("CSD CSD 772161_MW");
Console.WriteLine("=============================================================================");
var alarmEnableMask = 0xD39F0000;
var ix = 0;
var alarm = AlarmMask.ALARM_REBOOT
| AlarmMask.ALARM_EMPTY_PIPE
| AlarmMask.ALARM_SUSPECT_LEAK
| AlarmMask.ALARM_BROKEN_PIPE
| AlarmMask.ALARM_LOW_BATTERY
| AlarmMask.ALARM_REVERSE_FLOW;
foreach (var item in Enum.GetValues(typeof(AlarmMask)).Cast<AlarmMask>().OrderBy(x => (uint)x).ToArray())
{
Console.WriteLine($"{item,23} = {item:X} = {(uint)item,5} = {(alarmEnableMask << ix++) & 1}");
}
Console.WriteLine($"CUSTOMER_AlarmVisualMask: {BitConverter.ToString(BitConverter.GetBytes((int)alarm))}");
//foreach (var item in Enum.GetValues(typeof(FDRMask)).Cast<FDRMask>().OrderBy(x => x).ToArray())
//{
// Console.WriteLine($"{item} = {item:X} = {(uint)item}");
//}
//ushort value = 3;
//Console.WriteLine($"0: {value >> 0 & 1}");
//Console.WriteLine($"0: {value >> 1 & 1}");
//Console.WriteLine($"0: {value >> 2 & 1}");
//Console.WriteLine("CSD CSD 772161_MW");
//Console.WriteLine("=============================================================================");
//var alarm = AlarmMask.ALARM_REBOOT
// | AlarmMask.ALARM_EMPTY_PIPE
// | AlarmMask.ALARM_LOW_BATTERY
// | AlarmMask.ALARM_REVERSE_FLOW;
//Console.WriteLine($"CUSTOMER_AlarmVisualMask: {BitConverter.ToString(BitConverter.GetBytes((int)alarm))}");
var dlg = FDRMask.LOG_BILLING_COUNTER
| FDRMask.LOG_MIN_FLOW_VAL
| FDRMask.LOG_CUR_FLOW_VAL // ... AverageFlow !?
| FDRMask.LOG_ALARM_STATE
| FDRMask.LOG_EXT_ALARM_STATE;
//var dlg = FDRMask.LOG_BILLING_COUNTER
// | FDRMask.LOG_MIN_FLOW_VAL
// | FDRMask.LOG_CUR_FLOW_VAL // ... AverageFlow !?
// | FDRMask.LOG_ALARM_STATE
// | FDRMask.LOG_EXT_ALARM_STATE;
Console.WriteLine($"PERIODICLOG_DataLogContents: {BitConverter.ToString(BitConverter.GetBytes((int)dlg))}");
//Console.WriteLine($"PERIODICLOG_DataLogContents: {BitConverter.ToString(BitConverter.GetBytes((int)dlg))}");
var fdr = FDRMask.LOG_BILLING_COUNTER
| FDRMask.LOG_MIN_FLOW_VAL
| FDRMask.LOG_CUR_FLOW_VAL // ... AverageFlow !?
| FDRMask.LOG_ALARM_STATE
| FDRMask.LOG_EXT_ALARM_STATE;
//var fdr = FDRMask.LOG_BILLING_COUNTER
// | FDRMask.LOG_MIN_FLOW_VAL
// | FDRMask.LOG_CUR_FLOW_VAL // ... AverageFlow !?
// | FDRMask.LOG_ALARM_STATE
// | FDRMask.LOG_EXT_ALARM_STATE;
Console.WriteLine($"PERIODICLOG_FixedDateReadingContents: {BitConverter.ToString(BitConverter.GetBytes((int)fdr))}");
//Console.WriteLine($"PERIODICLOG_FixedDateReadingContents: {BitConverter.ToString(BitConverter.GetBytes((int)fdr))}");
}
}
}
+6 -1
View File
@@ -22,7 +22,12 @@ namespace Xylem.Common.CommonCore.Consts
/// <summary>
/// Name for meter config
/// </summary>
public const String ConfigFileName = "MeterConfig.json";
public const String MeterConfigFileName = "MeterConfig.json";
/// <summary>
/// Name for SIRT config
/// </summary>
public const String SirtConfigFileName = "SirtConfig.json";
/// <summary>
/// Name for offline information e.g. Passwords
@@ -128,6 +128,8 @@
if (addresses.Any(x => x == 0 || x == address))
{
task.SirtId = this.Id;
this.tasks
.AddOrUpdate(task.ResponseAddress, addr => task, (addr, oldTask) => task);
var bytes = this.tasks
.AddOrUpdate(address, addr => task, (addr, oldTask) => task)
.Start();
@@ -110,6 +110,8 @@
public override bool Equals(object other)
=> other is SIRTTask _task && _task.taskId == this.taskId;
public override int GetHashCode() => (int)this.RequestAddress;
public static implicit operator SIRTMessage(SIRTTask task) => task.request;
}
}
@@ -91,7 +91,7 @@
set => this.request.Payload = value;
}
public bool AnyTelegramReceived { get; protected set; }
public bool AnyTelegramReceived { get; set; }
public override void Push(SIRTMessage response)
{
@@ -49,7 +49,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig
/// <summary>
/// Send delay between records in milliseconds before
/// new record is going to be send or between retries,
/// new record is going to be sent or between retries,
/// this time is independent of the timeout, it is
/// used to delay the next send record after successful
/// response from meter.
@@ -100,10 +100,15 @@
</Compile>
<Compile Include="CommunicationConfig.cs" />
<Compile Include="Const\MeterConfig.cs" />
<Compile Include="SirtConfig.cs" />
<Compile Include="ProcessConfig.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\CommonCore\CommonCore.csproj">
<Project>{1B02C79E-0B19-43E2-8F6B-71EF0C786C97}</Project>
<Name>CommonCore</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Interfaces\Ports\PortCore\PortCore.csproj">
<Project>{2E139F63-B6FE-4EA9-A098-85364FE9B26C}</Project>
<Name>PortCore</Name>
@@ -2,6 +2,7 @@
using System.ComponentModel;
using System.IO;
using Newtonsoft.Json;
using Xylem.Common.CommonCore.Consts;
namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig
{
@@ -10,35 +11,26 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig
/// </summary>
public class ProcessConfig
{
/// <summary>
/// ctor
/// </summary>
public ProcessConfig()
{
UseRegisterWatchService = false;
UseErrorLogger = false;
AutoUpdateFiles = false;
ProductionMode = true;
}
/// <summary>
/// Load configuration file from AppRoaming or working directory
/// </summary>
/// <param name="file"></param>
public ProcessConfig(String file)
public Boolean ReadProcessConfig()
{
// check for AppRoaming
var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), nameof(Genesis), file);
// Check for AppRoaming
var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
nameof(Genesis), ProgramConfig.MeterConfigFileName);
if (!File.Exists(configFile))
{
// take actual working directory
configFile = Path.Combine(file);
// Take actual working directory
configFile = Path.Combine(ProgramConfig.MeterConfigFileName);
if (!File.Exists(configFile))
{
UseRegisterWatchService = false;
UseErrorLogger = false;
return;
AutoUpdateFiles = false;
ProductionMode = true;
return false;
}
}
@@ -54,21 +46,21 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig
CalibrationLoggerServiceUrl = meterConfig.CalibrationLoggerServiceUrl;
AutoUpdateFiles = meterConfig.AutoUpdateFiles;
ProductionMode = meterConfig.ProductionMode;
}
return true;
}
/// <summary>
/// Write file to AppRoaming and backup it to actual working directory
/// </summary>
/// <param name="file"></param>
public void Update(String file)
public void Update()
{
var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), nameof(Genesis), file);
var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
nameof(Genesis), ProgramConfig.MeterConfigFileName);
File.WriteAllText(configFile, JsonConvert.SerializeObject(this));
File.WriteAllText(file, JsonConvert.SerializeObject(this));
File.WriteAllText(ProgramConfig.MeterConfigFileName, JsonConvert.SerializeObject(this));
}
/// <summary>
@@ -114,6 +106,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig
[DefaultValue(true)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public Boolean ProductionMode { get; set; } = true;
public Boolean ProductionMode { get; set; }
}
}
@@ -0,0 +1,81 @@
using System;
using System.IO;
using Newtonsoft.Json;
using Xylem.Common.CommonCore.Consts;
namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig
{
/// <summary>
/// Configuration of SIRT
/// </summary>
public class SirtConfig
{
/// <summary>
/// Load SIRT configuration file from AppRoaming or working directory
/// </summary>
public Boolean ReadSirtConfig()
{
// Check for AppRoaming
var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
nameof(Genesis), ProgramConfig.SirtConfigFileName);
if (!File.Exists(configFile))
{
// Take actual working directory
configFile = Path.Combine(ProgramConfig.SirtConfigFileName);
if (!File.Exists(configFile))
{
SirtComport433MHz = null;
SirtComport868MHz = null;
SirtBoxNo = null;
StationId = null;
return false;
}
}
using (var tr = new StreamReader(configFile))
{
var sirtConfig = JsonConvert.DeserializeObject<SirtConfig>(tr.ReadToEnd());
SirtComport433MHz = sirtConfig.SirtComport433MHz;
SirtComport868MHz = sirtConfig.SirtComport868MHz;
SirtBoxNo = sirtConfig.SirtBoxNo;
StationId = sirtConfig.StationId;
}
return true;
}
/// <summary>
/// Write file to AppRoaming and backup it to actual working directory
/// </summary>
public void Update()
{
var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
nameof(Genesis), ProgramConfig.SirtConfigFileName);
File.WriteAllText(configFile, JsonConvert.SerializeObject(this));
File.WriteAllText(ProgramConfig.SirtConfigFileName, JsonConvert.SerializeObject(this));
}
/// <summary>
/// Comport for SIRT interface with 433MHz radio frequency
/// </summary>
public String SirtComport433MHz { get; set; }
/// <summary>
/// Comport for SIRT interface with 868MHz radio frequency
/// </summary>
public String SirtComport868MHz { get; set; }
/// <summary>
/// Box number for calibration settings
/// </summary>
public Int32? SirtBoxNo { get; set; }
/// <summary>
/// Station ID where the SIRT is used
/// </summary>
public Int32? StationId { get; set; }
}
}
@@ -142,7 +142,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// <summary>
/// Process configuration
/// </summary>
public ProcessConfig Configuration { internal set; get; } = new ProcessConfig();
public ProcessConfig Configuration { internal set; get; } //= new ProcessConfig();
/// <summary>
/// Transmit protocol access for underlie objects to change response timeout
@@ -798,7 +798,8 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
ledTransmit.GetTransmitPortSettings());
StreamingProtocol = new StreamingProtocol(streamingIdent, ignoreCorruptedData);
}
Configuration = new ProcessConfig(ProgramConfig.ConfigFileName);
Configuration = new ProcessConfig();
Configuration.ReadProcessConfig();
Logger.Debug($"Slot:{Slot} - Setup done");
}
@@ -95,7 +95,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
private static readonly List<String> _excludedFromCompareParameters = new List<String>
{
"CUSTOMER_AlarmVisualMask", // Fully hard coded, cannot be overwritten
//"CUSTOMER_AlarmEnableMask", //Depending on FW version Will be overwritten by SENSUSRADIO if set System state to 0xFF
"CUSTOMER_AppArrangement", // Is read only, makes no sense to compare anything
"SENSUSRADIO_UpgFWVersion" // After a FW-Update the FW version has changed
};
@@ -111,7 +110,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// </summary>
private static readonly List<String> _fieldUpdateBlacklist = new List<String>
{
//TODO THW "CUSTOMER_AlarmEnableMask", // Under discussion
"CUSTOMER_AlarmVisualMask",
"CUSTOMER_BackupCalendarSeconds",
"CUSTOMER_InstallationTime",
@@ -667,7 +667,7 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore
ledTransmit.GetTransmitPortSettings());
StreamingProtocol = new StreamingProtocol(streamingIdent, ignoreCorruptedData);
}
Configuration = new ProcessConfig(ProgramConfig.ConfigFileName);
Configuration = new ProcessConfig(ProgramConfig.MeterConfigFileName);
SetLogger();
WriteLog("Setup done");
@@ -1 +1 @@
b03dfbada453427a2bb1275645a5f1b525f29900
8cb55c312de586b683d72cf58c13e2801d10e14b767777d98338d3e1473a1213
@@ -4,6 +4,7 @@
using Common.Hardware.SIRT.Tasks;
using Common.Hardware.WaterMeter.eRegister.Features;
using Common.Hardware.WaterMeter.eRegister.Models;
using Common.Hardware.WaterMeter.eRegister.Telegrams;
using System;
using System.Collections.Concurrent;
@@ -75,19 +76,35 @@
this.LoadProgrammingParameters(features);
if (!parameters.IsValid)
// The last checked DEBUG telegram
this.runningTasks.Enqueue(new EregisterCheckFinalizationTask(this.parameters, features.Frequency)
{
this.runningTasks.Enqueue(new EregisterCheckFinalizationTask(this.parameters, features.Frequency)
{
SlotNr = features.SlotNr,
PoNr = features.PoNr,
SerialNr = features.SerialNr,
DelPamSemi = true,
RequestAddress = features.RequestAddress,
ResponseAddress = features.ResponseAddress,
EncryptionKey = features.EncryptionKey
});
}
SlotNr = features.SlotNr,
PoNr = features.PoNr,
SerialNr = features.SerialNr,
RequestAddress = features.ResponseAddress,
ResponseAddress = features.ResponseAddress,
EncryptionKey = features.EncryptionKey,
IsEncrypted = this.parameters.IsEncrypted,
});
// Setting all transmision intervals at the end
this.runningTasks.Enqueue(new EregisterTask(features.Frequency)
{
SlotNr = features.SlotNr,
PoNr = features.PoNr,
SerialNr = features.SerialNr,
RequestAddress = features.ResponseAddress,
ResponseAddress = features.ResponseAddress,
EncryptionKey = features.EncryptionKey,
IsEncrypted = this.parameters.IsEncrypted,
Data = new ChangeWakeUp((WakeUpMode)this.parameters.Wake_Up_Interval)
.Append(new ChangeNumberOfLatWindows(this.parameters.LAT_Interval))
.Append(new ChangeTransmissionInterval(this.parameters.Transmission_Intervall))
.Append(new OpenMeteringTransmitionIntervalWMBus(this.parameters.OMS_Interval))
.Append(new ProvidePin(AuthLevel.II)),
Name = "0, 2, 16, 17",
});
return this.runningTasks.AsEnumerable();
}
@@ -104,6 +121,9 @@
var stopProgramming = false;
var task = default(EregisterTask);
var lat = default(LAT);
var debug = default(DEBUG);
var semi = default(SEMI);
while (this.runningTasks.TryPeek(out task) && task.State != SIRTTaskState.Cancelled && !cancellationToken.IsCancellationRequested)
{
@@ -129,20 +149,18 @@
break;
}
}
}
}
task.MessageReceived -= this.history.Push;
if (task.FactoryState == FactoryState.Shipment)
{
task.Label = "GESCHLOSSEN";
break;
}
if (stopProgramming)
{
if (task.FactoryState == FactoryState.Shipment)
{
task.Label = "GESCHLOSSEN";
}
break;
}
@@ -150,7 +168,14 @@
if (task.State == SIRTTaskState.Completed)
{
if (!this.runningTasks.TryDequeue(out _))
if (task.DEBUGMessage != null)
{
lat = task.LATMessage;
debug = task.DEBUGMessage;
semi = task.SEMIMessage;
}
if (!this.runningTasks.TryDequeue(out task))
{
MessageBox.Show($"Task an Ep: {task.SlotNr} mit Funkadresse: {task.RequestAddress}|{task.ResponseAddress} könnte nicht gelöscht werden."
, "Achtung"
@@ -161,6 +186,8 @@
}
else if (task.State == SIRTTaskState.Cancelled)
{
stopProgramming = true;
break;
}
}
@@ -174,10 +201,10 @@
{
this.state.ShouldUpdate = true;
this.state.Bemerkung = this.executionType;
this.state.BUP = (task.LATMessage ?? task.BUPMessage)?.ToString()?.Replace('-', '\t');
this.state.DEBUG = task.DEBUGMessage?.ToString()?.Replace('-', '\t');
this.state.Fabrikationsnummer = task.DEBUGMessage?.PCBID;
this.state.SEMI = task.SEMIMessage?.ToString()?.Replace('-', '\t');
this.state.Fabrikationsnummer = debug?.PCBID;
this.state.BUP = lat?.ToString()?.Replace('-', '\t');
this.state.DEBUG = debug?.ToString()?.Replace('-', '\t');
this.state.SEMI = semi?.ToString()?.Replace('-', '\t');
this.state.SemiDebugDatum = DateTime.Now;
this.state.Seriennummer = this.parameters.SerienNr;
this.state.TempAdresse = this.parameters.TempAdresse;
@@ -202,6 +229,7 @@
eregisterTask.SetCancelled();
}
eregisterTask.AnyTelegramReceived = task.AnyTelegramReceived;
eregisterTask.RequestAddress = task.RequestAddress;
eregisterTask.ResponseAddress = task.ResponseAddress;
eregisterTask.FactoryState = task.FactoryState;
@@ -230,15 +258,31 @@
SlotNr = features.SlotNr,
PoNr = features.PoNr,
SerialNr = features.SerialNr,
DelPamTx = true,
WakeUpCmd = true,
WakeUpModul = true,
RequestAddress = features.RequestAddress,
RequestAddress = features.ResponseAddress,
ResponseAddress = features.ResponseAddress,
EncryptionKey = features.EncryptionKey,
IsEncrypted = this.parameters.IsEncrypted,
});
if (this.executionType == nameof(LoadInspectionFinalizationTasks))
{
this.runningTasks.Enqueue(new EregisterTask(features.Frequency)
{
SlotNr = features.SlotNr,
PoNr = features.PoNr,
SerialNr = features.SerialNr,
RequestAddress = features.ResponseAddress,
ResponseAddress = features.ResponseAddress,
EncryptionKey = features.EncryptionKey,
Data = new ChangeWakeUp()
.Append(new ChangeNumberOfLatWindows()
.Append(new ChangeTransmissionInterval(3))
.Append(new OpenMeteringTransmitionIntervalWMBus(this.parameters.OMS_Interval))
.Append(new ProvidePin(AuthLevel.II))),
Name = "0, 2, 16, 17",
});
}
foreach (var pam in features.BuildPams())
{
this.runningTasks.Enqueue(new EregisterTask(frequency)
@@ -246,13 +290,12 @@
SlotNr = features.SlotNr,
PoNr = features.PoNr,
SerialNr = features.SerialNr,
Name = pam.Key,
DelPamSemi = true,
RequestAddress = features.RequestAddress,
RequestAddress = features.ResponseAddress,
ResponseAddress = features.ResponseAddress,
Data = pam.Value,
EncryptionKey = features.EncryptionKey,
IsEncrypted = this.parameters.IsEncrypted,
Data = pam.Value,
Name = pam.Key
});
}
}
@@ -15,7 +15,7 @@
public EregisterCheckInitializationTask(EregisterProgrammingParameters parameters, int frequency) : base(frequency)
{
this.parameters = parameters;
this.Name = "Get DEBUG";
this.Name = "Check state";
this.Data = new OpticalTelegram
{
Minutes = 1
@@ -17,13 +17,14 @@
public EregisterTask(int frequency)
{
this.Timeout = 10_000;
this.DelPamSemi = true;
this.Frequency = frequency;
this.RSSI = new RSSI(0, frequency);
this.Label = nameof(SIRTTaskState.Pending);
}
public event Action<EregisterTask> Changed;
public event Action<byte[]> MessageReceived;
public new event Action<byte[]> MessageReceived;
public int SlotNr { get; internal set; }
@@ -74,8 +75,13 @@
public ErrorMessage ErrorMessage { get; protected set; }
public bool SkipWakeUpCommands { get; set; }
public override byte[] Start()
{
this.WakeUpCmd = !this.AnyTelegramReceived;
this.WakeUpModul = !this.AnyTelegramReceived;
var payloadL = this.request.Payload.Length;
this.payload = new byte[payloadL];
@@ -96,6 +102,7 @@
this.LATMessage = default(LAT);
this.DEBUGMessage = default(DEBUG);
this.SEMIMessage = default(SEMI);
this.AnyTelegramReceived = false;
this.SetRunning();
@@ -114,23 +121,24 @@
public override void Push(SIRTMessage response)
{
this.AnyTelegramReceived = true;
if (this.State == SIRTTaskState.Cancelled)
{
this.Label = nameof(SIRTTaskState.Cancelled);
}
else if (this.State != SIRTTaskState.Completed)
{
if (response.Address == this.ResponseAddress)
{
var requestAddress = this.RequestAddress;
this.RequestAddress = this.ResponseAddress;
this.ResponseAddress = requestAddress;
}
if (response.Command == SIRTConstants.FROM_AIR)
{
this.AnyTelegramReceived = true;
if (response.Address == this.ResponseAddress)
{
var requestAddress = this.RequestAddress;
this.RequestAddress = this.ResponseAddress;
this.ResponseAddress = requestAddress;
this.Changed?.Invoke(this);
}
this.P11 = new P11(response.P1);
this.RSSI = new RSSI(response.P2, (ushort)this.Frequency);
@@ -243,7 +251,7 @@
this.Label = "NA";
}
}
this.MessageReceived?.Invoke(response);
}
@@ -72,14 +72,14 @@
{
var alarmMaskBuilder = new StringBuilder();
alarmMaskBuilder.AppendLine($"{nameof(this.SpecificError)}: {this.SpecificError}");
alarmMaskBuilder.AppendLine($"{nameof(this.MediumAbsent)}: {this.MediumAbsent}");
alarmMaskBuilder.AppendLine($"{nameof(this.BrokenPipe)}: {this.BrokenPipe}");
alarmMaskBuilder.AppendLine($"{nameof(this.Backflow)}: {this.Backflow}");
alarmMaskBuilder.AppendLine($"{nameof(this.MetrologyUnavailable)}: {this.MetrologyUnavailable}");
alarmMaskBuilder.AppendLine($"{nameof(this.MagneticTamper)}: {this.MagneticTamper}");
alarmMaskBuilder.AppendLine($"{nameof(this.Leak)}: {this.Leak}");
alarmMaskBuilder.AppendLine($"{nameof(this.LowBattery)}: {this.LowBattery}");
alarmMaskBuilder.AppendLine($"{nameof(this.SpecificError),20}: {this.SpecificError}");
alarmMaskBuilder.AppendLine($"{nameof(this.MediumAbsent),20}: {this.MediumAbsent}");
alarmMaskBuilder.AppendLine($"{nameof(this.BrokenPipe),20}: {this.BrokenPipe}");
alarmMaskBuilder.AppendLine($"{nameof(this.Backflow),20}: {this.Backflow}");
alarmMaskBuilder.AppendLine($"{nameof(this.MetrologyUnavailable),20}: {this.MetrologyUnavailable}");
alarmMaskBuilder.AppendLine($"{nameof(this.MagneticTamper),20}: {this.MagneticTamper}");
alarmMaskBuilder.AppendLine($"{nameof(this.Leak),20}: {this.Leak}");
alarmMaskBuilder.AppendLine($"{nameof(this.LowBattery),20}: {this.LowBattery}");
return alarmMaskBuilder.ToString().Trim();
}
@@ -29,5 +29,7 @@
Array.Copy(bytes, 0, this.bytes, 1, 9);
}
}
public static implicit operator ChangeCustomerText(string value) => new ChangeCustomerText(value);
}
}
@@ -6,10 +6,16 @@
{
}
public FactoryState Mode
public ChangeFactoryState(FactoryState factoryState)
: this()
=> this.FactoryState = factoryState;
public FactoryState FactoryState
{
get => (FactoryState)this.bytes[1];
set => this.bytes[1] = (byte)value;
}
public static implicit operator ChangeFactoryState(FactoryState value) => new ChangeFactoryState(value);
}
}
@@ -16,5 +16,7 @@
get => this.bytes.ToUInt32BE(1);
set => value.GetBytesBE().CopyTo(this.bytes, 1);
}
public static implicit operator ChangeMeterId(uint value) => new ChangeMeterId(value);
}
}
@@ -16,5 +16,7 @@
get => this.bytes.ToUInt32BE(1);
set => value.GetBytesBE().CopyTo(this.bytes, 1);
}
public static implicit operator ChangeMeterReading(uint value) => new ChangeMeterReading(value);
}
}
@@ -14,5 +14,7 @@
get => this.bytes[1];
set => this.bytes[1] = value;
}
public static implicit operator ChangeNumberOfLatWindows(byte value) => new ChangeNumberOfLatWindows(value);
}
}
@@ -16,5 +16,7 @@
get => this.bytes.ToUInt32BE(1);
set => value.GetBytesBE().CopyTo(this.bytes, 1);
}
public static implicit operator ChangeRadioId(uint address) => new ChangeRadioId(address);
}
}
@@ -6,12 +6,18 @@
public class ChangeSensusRFEncryptionKey : Pam
{
public ChangeSensusRFEncryptionKey() : base(17, ChangeSensusRFEncryptionKey)
public ChangeSensusRFEncryptionKey()
: base(17, ChangeSensusRFEncryptionKey)
{
}
public ChangeSensusRFEncryptionKey(byte[] encryptionKey) : this()
=> encryptionKey.CopyTo(this.bytes, 1);
public ChangeSensusRFEncryptionKey(byte[] encryptionKey)
: this()
=> this.Key = encryptionKey;
public ChangeSensusRFEncryptionKey(string encryptionKey)
: this()
=> this.HexKey = encryptionKey;
public byte[] Key
{
@@ -39,5 +45,9 @@
.Replace("-", string.Empty);
set => this.Key = value.GetEncryptionKey();
}
public static implicit operator ChangeSensusRFEncryptionKey(byte[] value) => new ChangeSensusRFEncryptionKey(value);
public static implicit operator ChangeSensusRFEncryptionKey(string value) => new ChangeSensusRFEncryptionKey(value);
}
}
@@ -14,5 +14,7 @@
get => this.bytes[2];
set => this.bytes[2] = value;
}
public static implicit operator ChangeTransmissionInterval(byte value) => new ChangeTransmissionInterval(value);
}
}
@@ -6,7 +6,8 @@
{
}
public DisableOTAFirmwareUpdate(byte parameter) : this()
public DisableOTAFirmwareUpdate(byte parameter)
: this()
=> this.bytes[1] = parameter;
public OTAMode Mode
@@ -14,5 +15,9 @@
get => (OTAMode)this.bytes[1];
set => this.bytes[1] = (byte)value;
}
public static implicit operator DisableOTAFirmwareUpdate(byte value) => new DisableOTAFirmwareUpdate(value);
public static implicit operator DisableOTAFirmwareUpdate(OTAMode value) => new DisableOTAFirmwareUpdate((byte)value);
}
}
@@ -14,5 +14,7 @@
get => this.bytes[1];
set => this.bytes[1] = value;
}
public static implicit operator OpticalTelegram(byte value) => new OpticalTelegram(value);
}
}
@@ -9,5 +9,7 @@
public ParameterizeBrokenPipeDetection(byte value) : base(value, ParameterizeBrokenPipeDetection)
{
}
public static implicit operator ParameterizeBrokenPipeDetection(byte value) => new ParameterizeBrokenPipeDetection(value);
}
}
@@ -13,5 +13,7 @@
public ParameterizeLeakageDetection(byte value) : base(value, ParameterizeLeakageDetection)
{
}
public static implicit operator ParameterizeLeakageDetection(byte value) => new ParameterizeLeakageDetection(value);
}
}
@@ -8,6 +8,10 @@
{
}
public ProvidePin(AuthLevel authLevel)
: base(6, ProvidePin)
=> this.AuthLevel = authLevel;
public AuthLevel AuthLevel
{
get
@@ -9,5 +9,7 @@
public ResetAlarms(byte value = byte.MaxValue) : base(value, ResetAlarms)
{
}
public static implicit operator ResetAlarms(byte value) => new ResetAlarms(value);
}
}
@@ -14,5 +14,7 @@
get => this.bytes[1];
set => this.bytes[1] = value;
}
public static implicit operator SetActivationByThreshold(byte value) => new SetActivationByThreshold(value);
}
}
@@ -1,6 +1,9 @@
namespace Common.Hardware.WaterMeter.eRegister.Features
{
using Common.Hardware.SIRT;
using Common.Hardware.WaterMeter.eRegister.Telegrams;
using System;
public class SetDateAndTime : Pam
{
@@ -13,5 +16,14 @@
get => this.bytes.ToUInt32BE(1);
set => value.GetBytesBE().CopyTo(this.bytes, 1);
}
public static implicit operator SetDateAndTime(double offset) => new SetDateAndTime
{
SecondsSince20000101 = new Epoch20000101
{
DateTime = DateTime.UtcNow.AddHours(offset)
}
};
}
}
@@ -12,5 +12,7 @@
public SetHistoricalErrorLimit(byte value) : base(value, SetHistoricalErrorLimit)
{
}
public static implicit operator SetHistoricalErrorLimit(byte value) => new SetHistoricalErrorLimit(value);
}
}
@@ -4,7 +4,12 @@
{
public SetPowerLevel() : base(SetPowerLevel)
{
}
public SetPowerLevel(byte powerLevel) : base(powerLevel, SetPowerLevel)
{
}
public static implicit operator SetPowerLevel(byte value) => new SetPowerLevel(value);
}
}
@@ -4,7 +4,8 @@
{
private const int CmdLength = 2;
public SingleBytePam(byte cmd) : base(CmdLength, cmd)
public SingleBytePam(byte cmd)
: base(CmdLength, cmd)
{
}
@@ -84,5 +84,7 @@
return base.ToByteArray();
}
public static implicit operator WirelessMBusMode(byte value) => new WirelessMBusMode(value);
}
}
@@ -3,7 +3,6 @@
using Common.Hardware.SIRT;
using Common.Hardware.WaterMeter.eRegister.Attributes;
using Common.Hardware.WaterMeter.eRegister.Features;
using Common.Hardware.WaterMeter.eRegister.Telegrams;
using System;
using System.Xml.Serialization;
@@ -266,24 +265,41 @@
EncryptionKey = this.EncryptionKey.GetEncryptionKey(),
};
features.ChangeMeterReading = this.DisplayVolume;
features.Debug = new EregisterDebugFeatures();
if (!this.IsEbeling && !this.IsFuhzoe)
{
features.Debug.DisableOTAFirmwareUpdate = this.DisableOTA;
features.Debug.SetActivationByThreshold = this.ActivationByThreshold;
}
if (this.StatusFertigung != 30)
{
features.ChangeMeterReading = new ChangeMeterReading(333_333_333);
features.ChangeMeterReading = 333_333_333;
features.Debug = new EregisterDebugFeatures
{
OpticalTelegram = new OpticalTelegram
{
Minutes = 0
}
OpticalTelegram = 0
};
return features;
}
features.Debug = new EregisterDebugFeatures();
features.ChangeMeterReading = new ChangeMeterReading(this.DisplayVolume);
features.ChangeRadioId = new ChangeRadioId((uint)this.Adresse);
features.ChangeMeterId = new ChangeMeterId(this.MeterId);
if (!this.IsEbeling)
{
features.WirelessMBusMode = this.MBusStatus;
if (!string.IsNullOrWhiteSpace(this.EncryptionKey))
{
features.ChangeSensusRFEncryptionKey = this.EncryptionKey;
}
features.Debug.ChangeState = FactoryState.Shipment;
}
features.ChangeRadioId = (uint)this.Adresse;
features.ChangeMeterId = this.MeterId;
features.DeactivateAlarms = new DeactivateAlarms
{
Backflow = this.Alarm_Backflow,
@@ -295,30 +311,12 @@
MetrologyUnavailable = this.Alarm_Metrology_Unavailable,
SpecificError = this.Alarm_Specific_Error,
};
features.ResetAlarms = new ResetAlarms(0xFF);
features.SetDateAndTime = new SetDateAndTime
{
SecondsSince20000101 = new Epoch20000101
{
DateTime = DateTime.UtcNow.AddHours(this.UTC_Offset)
}
};
features.ChangeCustomerText = new ChangeCustomerText
{
Text = this.CustomerSpecificText
};
features.ParameterizeLeakageDetection = new ParameterizeLeakageDetection
{
Value = (byte)(this.LeakagePeriod | (this.LeakageThreshold * (byte)Math.Pow(2, 3)))
};
features.ParameterizeBrokenPipeDetection = new ParameterizeBrokenPipeDetection
{
Value = (byte)(this.BrokenPipePeriod | (this.BrokenPipeThreshold * (byte)Math.Pow(2, 3)))
};
features.SetHistoricalErrorLimit = new SetHistoricalErrorLimit
{
Value = this.History_Error_Limits_Days
};
features.ResetAlarms = 0xFF;
features.SetDateAndTime = this.UTC_Offset;
features.ChangeCustomerText = this.CustomerSpecificText;
features.ParameterizeLeakageDetection = (byte)(this.LeakagePeriod | (this.LeakageThreshold * (byte)Math.Pow(2, 3)));
features.ParameterizeBrokenPipeDetection = (byte)(this.BrokenPipePeriod | (this.BrokenPipeThreshold * (byte)Math.Pow(2, 3)));
features.SetHistoricalErrorLimit = this.History_Error_Limits_Days;
features.ChangeDataLoggerSettings = new ChangeDataLoggerSettings
{
TimeInterval = this.Data_Logging_Period,
@@ -353,70 +351,11 @@
Counter = this.FDR_Counter,
AlarmState = this.FDR_Alarm_State,
};
features.WirelessMBusMode = new WirelessMBusMode(this.MBusStatus);
if (this.PowerLevelHex != null)
{
features.SetPowerLevelSensusRF = new SetPowerLevel
{
Value = (byte)(this.PowerLevelHex & 127)
};
features.SetPowerLevelFlexNet = new SetPowerLevel
{
Value = (byte)(this.PowerLevelHex | 128)
};
}
if (!this.IsEbeling && !this.IsFuhzoe)
{
features.Debug.DisableOTAFirmwareUpdate = new DisableOTAFirmwareUpdate
{
Mode = (OTAMode)this.DisableOTA
};
features.Debug.SetActivationByThreshold = new SetActivationByThreshold
{
Rotations = this.ActivationByThreshold
};
features.OpenMeteringTransmitionIntervalWMBus = new OpenMeteringTransmitionIntervalWMBus
{
Seconds = this.OMS_Interval
};
features.ChangeWakeUp = new ChangeWakeUp
{
Mode = this.Wake_Up_Interval
};
}
if (!this.IsEbeling)
{
features.ChangeTransmissionInterval = new ChangeTransmissionInterval
{
Seconds = this.Transmission_Intervall,
};
features.ChangeNumberOfLatWindows = new ChangeNumberOfLatWindows
{
N = this.LAT_Interval
};
features.WirelessMBusMode = new WirelessMBusMode(this.MBusStatus);
if (!string.IsNullOrWhiteSpace(this.EncryptionKey))
{
features.ChangeSensusRFEncryptionKey = new ChangeSensusRFEncryptionKey
{
HexKey = this.EncryptionKey
};
}
//features.Debug.ChangeState = new ChangeFactoryState
//{
// Mode = FactoryState.Shipment
//};
features.SetPowerLevelSensusRF = (byte)(this.PowerLevelHex & 127);
features.SetPowerLevelFlexNet = (byte)(this.PowerLevelHex | 128);
}
return features;
@@ -435,11 +374,11 @@
EncryptionKey = this.EncryptionKey.GetEncryptionKey(),
};
features.ChangeWakeUp = new ChangeWakeUp(WakeUpMode.StayAwake);
features.ChangeTransmissionInterval = new ChangeTransmissionInterval(this.TransmissionIntervalInitialization);
features.ChangeNumberOfLatWindows = new ChangeNumberOfLatWindows(this.LatWindowsInitialization);
features.ChangeMeterReading = new ChangeMeterReading(111_111_111);
features.WirelessMBusMode = new WirelessMBusMode(this.MBusStatus);
features.ChangeWakeUp = WakeUpMode.StayAwake;
features.ChangeTransmissionInterval = this.TransmissionIntervalInitialization;
features.ChangeNumberOfLatWindows = this.LatWindowsInitialization;
features.ChangeMeterReading = 111_111_111;
features.WirelessMBusMode = this.MBusStatus;
features.SetMetrologyParameters = new SetMetrologyParameters
{
UseCandIRules = this.DisallowReverseVolume,
@@ -454,10 +393,7 @@
};
features.Debug = new EregisterDebugFeatures
{
OpticalTelegram = new OpticalTelegram
{
Minutes = this.LED_ON_Minutes
}
OpticalTelegram = this.LED_ON_Minutes
};
return features;
@@ -35,11 +35,10 @@
<appSettings>
<add key="Mode" value="1" /> <!--1 = EOL ; 2 = Picking-->
<add key="SirtComport433" value="14" /> <!--Thomas 14; Roland ; Stoyan ; VFM1 9; VFM4 7-->
<add key="SirtComport868" value="15" /> <!--Thomas 15; Roland ; Stoyan ; VFM1 10; VFM4 8-->
<add key="SirtBoxNr" value="2" /> <!--Thomas 2; Roland 2; Stoyan 2; VFM1 1; VFM4 3-->
<add key="StationID" value="2" /> <!--Thomas 2; Roland 2; Stoyan 2; VFM1 1; VFM4 4-->
<!--add key="SirtComport433" value="14" /--> <!--Thomas 14; Roland ; Stoyan ; VFM1 9; VFM4 7-->
<!--add key="SirtComport868" value="15" /--> <!--Thomas 15; Roland ; Stoyan ; VFM1 10; VFM4 8-->
<!--add key="SirtBoxNr" value="2" /--> <!--Thomas 2; Roland 2; Stoyan 2; VFM1 1; VFM4 3-->
<!--add key="StationID" value="2" /--> <!--Thomas 2; Roland 2; Stoyan 2; VFM1 1; VFM4 4-->
</appSettings>
@@ -1,137 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;
namespace Xylem.Common.Production.ProductionUiCordonel
{
/// <summary>
/// Configuration of ProductionUi
/// </summary>
public class ApplicationSettings
{
public class Pos
{
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 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 Int32 Slot { get; set; }
public Int32? PressureStationId { get; set; }
public Boolean AutoDetect { get; set; }
public Boolean AccessToPresuretestTab { get; set; }
public Boolean AccessToMarrieTab { get; set; }
public Boolean AccessToFinalcheckTab { get; set; }
public Boolean AccessToSettingTab { get; set; }
public Boolean AccessToStatusTab { get; set; }
public Boolean AccessToPickingTab { get; set; }
public Int32? SirtComport433 { get; set; }
public Int32? SirtComport866 { get; set; }
public Int32? SirtBoxNr { get; set; }
public Int32? StationId { get; set; }
public List<MultiFormChilds> ChildForms { get; set; }
/// <summary>
/// ctor
/// </summary>
public ApplicationSettings()
{
Slot = 0;
AutoDetect = false;
AccessToPresuretestTab = false;
AccessToMarrieTab = false;
AccessToFinalcheckTab = false;
AccessToSettingTab = false;
AccessToPickingTab = false;
AccessToStatusTab = false;
PressureStationId = null;
SirtComport433 = null;
SirtComport866 = null;
SirtBoxNr = null;
ChildForms = new List<MultiFormChilds>();
StationId = null;
}
/// <inheritdoc />
public ApplicationSettings(String file)
{
//var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
//nameof(Xylem.Common.Hardware.WaterMeter.Genesis), file);
//if (!File.Exists(configFile))
//{
var configFile = Path.Combine(file);
if (!File.Exists(configFile))
{
Slot = 0;
AutoDetect = false;
AccessToPresuretestTab = false;
AccessToMarrieTab = false;
AccessToFinalcheckTab = false;
AccessToSettingTab = false;
AccessToPickingTab = false;
AccessToStatusTab = false;
PressureStationId = null;
ChildForms = new List<MultiFormChilds>();
StationId = null;
return;
}
//}
using (var tr = new StreamReader(configFile))
{
var meterConfig = JsonConvert.DeserializeObject<ApplicationSettings>(tr.ReadToEnd());
if (meterConfig != null)
{
Slot = meterConfig.Slot;
AutoDetect = meterConfig.AutoDetect;
AccessToPresuretestTab = meterConfig.AccessToPresuretestTab;
AccessToMarrieTab = meterConfig.AccessToMarrieTab;
AccessToFinalcheckTab = meterConfig.AccessToFinalcheckTab;
AccessToSettingTab = meterConfig.AccessToSettingTab;
AccessToPickingTab = meterConfig.AccessToPickingTab;
AccessToStatusTab = meterConfig.AccessToStatusTab;
PressureStationId = meterConfig.PressureStationId;
ChildForms = meterConfig.ChildForms;
StationId = meterConfig.StationId;
}
}
}
public void Update(String file)
{
var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
nameof(Hardware.WaterMeter.Genesis), file);
if (!File.Exists(configFile))
{
configFile = Path.Combine(file);
}
File.WriteAllText(file, JsonConvert.SerializeObject(this));
}
}
}
@@ -1,102 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//using System.Windows.Forms;
//namespace ProductionUiCordonel.BarcodeInput
//{
// public class Listener : NativeWindow
// {
// /// <summary>
// /// Initializes a new instance of the BarcodeScannerListener
// /// class. The raw input devices that this class will listen to are
// /// registered with the given window handle.
// /// </summary>
// /// <param name="form">the form that should listen for
// /// barcode scans</param>
// /// <exception cref="ArgumentNullException">if the form is null</exception>
// /// <exception cref="ApplicationException">if we are unable to register
// /// for raw input devices</exception>
// /// <exception cref="ConfigurationErrorsException">if an error occurs
// /// during configuration</exception>
// public Listener(Form form)
// {
// IntPtr hwnd;
// if (form == null)
// {
// throw new ArgumentNullException("form");
// }
// hwnd = form.Handle;
// HookRawInput(hwnd); // We'll take a look at this in a minute
// this.HookHandleEvents(form);
// this.AssignHandle(hwnd);
// }
// /// <summary>
// /// Registers ourselves to listen to raw input from keyboard-like devices.
// /// </summary>
// /// <param name="hwnd">the handle of the form that will receive the raw
// /// input messages</param>
// /// <exception cref="InvalidOperationException">if the call to register with the
// /// raw input API fails for some reason</exception>
// private static void HookRawInput(IntPtr hwnd)
// {
// NativeMethods.RAWINPUTDEVICE[] rid;
// rid = new NativeMethods.RAWINPUTDEVICE[1];
// rid[0].usUsagePage = 0x01; // USB HID Generic Desktop Page
// rid[0].usUsage = 0x06; // Keyboard Usage ID
// rid[0].dwFlags = NativeMethods.RawInputDeviceFlags.RIDEV_INPUTSINK;
// rid[0].hwndTarget = hwnd;
// if (!NativeMethods.RegisterRawInputDevices(rid, (uint)rid.Length, (uint)Marshal.SizeOf(rid[0])))
// {
// InvalidOperationException e;
// e = new InvalidOperationException(
// "The barcode scanner listener could not register for raw input devices.",
// new Win32Exception());
// throw e;
// }
// }
// /// <summary>
// /// Hooks into the form's HandleCreated and HandleDestoryed events
// /// to ensure that we start and stop listening at appropriate times.
// /// </summary>
// /// <param name="form">the form to listen to</param>
// private void HookHandleEvents(Form form)
// {
// form.HandleCreated += this.OnHandleCreated;
// form.HandleDestroyed += this.OnHandleDestroyed;
// }
// /// <summary>
// /// When the form's handle is created, let's hook into it so we can see
// /// the WM_INPUT event.
// /// </summary>
// /// <param name="sender">the form whose handle was created</param>
// /// <param name="e">the event arguments</param>
// private void OnHandleCreated(object sender, EventArgs e)
// {
// this.AssignHandle(((Form)sender).Handle);
// }
// /// <summary>
// /// When the form's handle is destroyed, let's unhook from it so we stop
// /// listening and allow the OS to free up its resources.
// /// </summary>
// /// <param name="sender">the form whose handle was destroyed</param>
// /// <param name="e">the event arguments</param>
// private void OnHandleDestroyed(object sender, EventArgs e)
// {
// this.ReleaseHandle();
// }
// }
//}
@@ -1,101 +0,0 @@
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
}
}
@@ -1,52 +0,0 @@
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();
}
}
}
@@ -1,19 +0,0 @@
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,120 +0,0 @@
using System;
using System.Windows.Media;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
namespace Xylem.Common.Production.ProductionUiCordonel.Data
{
public class PickingItemCheckReturn
{
public Boolean? Result;
public String Msg;
}
public abstract class PickingResultBaseData : IPickingResultData
{
public String Ident { get; set; }
public Int32 Index { get; set; }
public String CheckText { get; set; }
public String CurrentValueText { get; set; }
public Boolean? Result { get; set; }
public Boolean HasError { get; set; }
public Brush ResultColor => getColorFromResult();
public abstract Func<PickingItemCheckReturn> Action { get; }
private Brush getColorFromResult()
{
var converter = new BrushConverter();
var brush = (Brush)converter.ConvertFromString("#000000");
if (Result.HasValue) // && a.Result.Value ))
{
if (!Result.Value)
{
brush = (Brush)converter.ConvertFromString("#FF8000");
}
else
{
brush = (Brush)converter.ConvertFromString("#419C14");
}
}
return brush;
}
}
public interface IPickingResultData
{
String Ident { get; set; }
Int32 Index { get; set; }
String CheckText { get; set; }
String CurrentValueText { get; set; }
Boolean? Result { get; set; }
Boolean HasError { get; set; }
Brush ResultColor { get; }
Func<PickingItemCheckReturn> Action { get; }
}
public class PickingResultRegisterData : PickingResultBaseData
{
public String RegisterIdent { get; set; }
public GenesisMeter ReadMeter { get; set; }
public Object CompareObject { get; set; }
public override Func<PickingItemCheckReturn> Action => staticReadAndCompareAction();
public Func<PickingItemCheckReturn> staticReadAndCompareAction()
{
return delegate
{
var retComp = new PickingItemCheckReturn();
retComp.Result = null;
retComp.Msg = "-";
if (ReadMeter != null && ReadMeter.IsLoggedOn)
{
var r = ReadMeter.ReadRegister(RegisterIdent);
if (CompareObject is UInt32 intNumber)
{
retComp.Result = intNumber.Equals(RegisterConverter.ByteArrayToValue<UInt32>(r));
retComp.Msg = intNumber.ToString();
}
else if (CompareObject is Boolean boolCompare)
{
retComp.Result = boolCompare.Equals(RegisterConverter.ByteArrayToValue<Boolean>(r));
retComp.Msg = boolCompare.ToString();
}
}
return retComp;
};
}
}
public class PickingResultCustomCheckData : PickingResultBaseData
{
public PickingResultCustomCheckData(Func<PickingItemCheckReturn> action)
{
_action = action;
}
public readonly Func<PickingItemCheckReturn> _action;
public override Func<PickingItemCheckReturn> Action => _action;
}
}
@@ -1,162 +0,0 @@
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using Xylem.Common.Logic.ProductionOrderCore.TestResults;
namespace Xylem.Common.Production.ProductionUiCordonel.Data
{
public class PressureResultDataNotifyable : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public PressureResultDataNotifyable(PressureResultData baseData)
{
LeakRate = baseData.LeakRate;
Passed = baseData.Passed;
PcbId = baseData.PcbId;
Remark = baseData.Remark;
Rev = baseData.Rev;
TesterName = baseData.TesterName;
Testpoints = new ObservableCollection<PressureTestPoints>();
baseData.TestPoints.ForEach(o => Testpoints.Add(o));
TestPressure = baseData.TestPressure;
}
public PressureResultDataNotifyable()
{
}
public void InternalPropertyChanged(String propertyName = "")
{
NotifyPropertyChanged(propertyName);
}
public String PcbId;
private Int32 rev;
public Int32 Rev
{
get => rev;
set
{
rev = value;
InternalPropertyChanged(nameof(Rev));
}
}
private Boolean? passed = false;
public Boolean? Passed
{
get => passed;
set
{
passed = value;
InternalPropertyChanged(nameof(Passed));
}
}
private String testerName = "C. Röhl";
public String TesterName
{
get => testerName;
set
{
testerName = value;
InternalPropertyChanged(nameof(TesterName));
}
}
private String testPressure = "6";
public String TestPressure
{
get => testPressure;
set
{
testPressure = value;
InternalPropertyChanged(nameof(TestPressure));
}
}
private String leakRate = " 0,00001";
public String LeakRate
{
get => leakRate;
set
{
leakRate = value;
InternalPropertyChanged(nameof(LeakRate));
}
}
private String remark = "";
public String Remark
{
get => remark;
set
{
remark = value;
InternalPropertyChanged(nameof(Remark));
}
}
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 => testpoints;
set
{
testpoints = value;
InternalPropertyChanged(nameof(Testpoints));
}
}
internal void SetAllTestPoints(String input)
{
foreach (var item in Testpoints)
{
item.Input = input;
}
InternalPropertyChanged(nameof(Testpoints));
}
public PressureResultData ToBase()
{
var baseData = new PressureResultData();
baseData.LeakRate = LeakRate;
baseData.Passed = Passed;
baseData.PcbId = PcbId;
baseData.Remark = Remark;
baseData.Rev = Rev;
baseData.TesterName = TesterName;
baseData.TestPoints = Testpoints.ToList();
baseData.TestPressure = TestPressure;
return baseData;
}
}
}
@@ -1,12 +0,0 @@
using System;
using System.ComponentModel;
namespace Xylem.Common.Production.ProductionUiCordonel.Model
{
public interface IMultiModeChildViewModel : INotifyPropertyChanged, IDisposable
{
String GetChildIdent();
void InputText(String text);
}
}
@@ -1,158 +0,0 @@
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.SoftwareAccessHelper;
namespace Xylem.Common.Production.ProductionUiCordonel.Model
{
public class MarriageMultiModeViewModel : BaseMultiModeChildViewModel
{
private Boolean canMarry;
public Boolean CanMarry
{
get => canMarry;
set
{
canMarry = value;
NotifyPropertyChanged();
}
}
private Int32 serialNr;
public Int32 SerialNr
{
get => serialNr;
set
{
serialNr = value;
NotifyPropertyChanged();
}
}
private Boolean locked = false;
public MarriageMultiModeViewModel(String ctrName, Int32 slotNR, List<String> barcodeTrigger, Int32? stationID = null) :
base(ctrName, slotNR, barcodeTrigger, stationID)
{
VisibilityMarriage = Visibility.Visible;
MeterDetectedHandler += PickingMultiModeViewModel_MeterDetectedHandler;
}
internal async Task<Boolean> Store()
{
var url = $"{ServiceUrls.MarriageServiceUrl()}SetPcbToSerial?PcbId={CurrentPcbID}&SerialNumber={SerialNr}&returnMetroData=0";
return await Task.Run(() =>
{
try
{
//url = "http://10.49.40.25/MeterProcessState/api/Marriage/SetPcbToSerial?PcbId=201420242&SerialNumber=20728820&returnMetroData=1";
var resp = LocalWebRequest.GetRequest(url);
if (!string.IsNullOrEmpty(resp))
{
if (CurrentMeter != null)
{
CurrentMeter.Login();
//if (resp.Trim() != "store")
//{
// var myJsonResponse = JsonConvert.DeserializeObject<IList<Programming_programming_parameters>>(resp);
// foreach (var item in myJsonResponse)
// {
// CurrentMeter.WriteRegister(item.RegisterName, item.RegisterValue);
// }
//}
CurrentMeter.SetProcessState(DisplayCodes.Mounted);
CurrentMeter.GetLastProcessState();
}
return true;
}
Log($"No result for {url} on Store");
return false;
}
catch (Exception ex)
{
if (ex is WebException)
{
Log($"Error on Store {url}: {Environment.NewLine} {((WebException)ex).Message}");
}
else
{
Log(ex.Message);
}
}
return false;
});
}
private void PickingMultiModeViewModel_MeterDetectedHandler(Object sender, EventArgs e)
{
CheckBtnEnable();
}
private void CheckBtnEnable()
{
if (SerialNr > 0 && !string.IsNullOrEmpty(CurrentPcbID))
{
CanMarry = true;
}
else
{
CanMarry = false;
}
}
public override void InputText(String text)
{
try
{
SerialNr = 0;
text = text.Replace(" ", "");
var preFix = "8SEN20";
if (text.Contains(preFix) && text.Contains(","))
{
var tmpSerialNr = 0;
var srText = text.Substring(text.IndexOf(preFix) + preFix.Length, text.IndexOf(",") - preFix.Length);
if (int.TryParse(srText, out tmpSerialNr))
{
SerialNr = tmpSerialNr;
}
}
CheckBtnEnable();
}
catch (Exception ex)
{
Log(ex.Message);
}
finally
{
CheckBtnEnable();
}
}
public override Boolean SlotIsLocked()
{
return locked;
}
}
}
@@ -1,332 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Timers;
using System.Windows;
using NLog;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
using Xylem.Common.Utils.Logging;
namespace Xylem.Common.Production.ProductionUiCordonel.Model
{
public abstract class BaseMultiModeChildViewModel : IMultiModeChildViewModel
{
private readonly ILogger _logger;
private Timer tmrAutoDetect;
public EventHandler OnPcbIdDetect;
public List<String> BarcodeTrigger = new List<String>();
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 => visibilityMarriage;
set
{
visibilityMarriage = value;
NotifyPropertyChanged();
}
}
private Visibility visibilityPicking = Visibility.Collapsed;
public Visibility VisibilityPicking
{
get => visibilityPicking;
set
{
visibilityPicking = value;
NotifyPropertyChanged();
}
}
private Visibility visibilityPressure = Visibility.Collapsed;
public Visibility VisibilityPressure
{
get => visibilityPressure;
set
{
visibilityPressure = value;
NotifyPropertyChanged();
}
}
public String currentSlotStateText = "none";
public String CurrentSlotStateText
{
get => currentSlotStateText;
set
{
currentSlotStateText = value;
NotifyPropertyChanged();
}
}
private SlotState currentSlotState = SlotState.None;
public SlotState CurrentSlotState
{
get => currentSlotState;
set
{
currentSlotState = value;
switch (currentSlotState)
{
case SlotState.None:
CurrentSlotStateText = "Keiner";
break;
case SlotState.IsDetecting:
CurrentSlotStateText = "Warte auf Zähler Kontakt";
break;
case SlotState.Detected:
CurrentSlotStateText = "Zähler detektiert";
break;
case SlotState.InProgress:
CurrentSlotStateText = "Zähler wird bearbeitet";
break;
case SlotState.Done:
CurrentSlotStateText = "Zähler wurde bearbeitet";
break;
case SlotState.ConnectionLost:
CurrentSlotStateText = "Verbindung getrennt";
break;
case SlotState.Error:
CurrentSlotStateText = "Fehler beim bearbeitet";
break;
case SlotState.Fatal:
CurrentSlotStateText = "Schwerwiegender Fehler";
break;
}
NotifyPropertyChanged();
}
}
private String slotInfo = "-";
public String SlotInfo
{
get => slotInfo;
set
{
slotInfo = value;
NotifyPropertyChanged();
}
}
public enum SlotState
{
None,
IsDetecting,
Detected,
InProgress,
Done,
ConnectionLost,
Error,
Fatal
}
private String childName = "asd";
public String ChildName
{
get => childName;
set
{
childName = value;
NotifyPropertyChanged();
}
}
private String order;
public String Order
{
get => order;
set
{
order = value;
NotifyPropertyChanged();
}
}
public String CurrentPcbID
{
get => _currentPcbID;
set
{
_currentPcbID = value;
NotifyPropertyChanged();
}
}
public GenesisMeter CurrentMeter { get; private set; }
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public String GetChildIdent()
{
return ChildName;
}
public Int32 SlotNr;
public BaseMultiModeChildViewModel(String ctrName, Int32 slotNR,List<String> barcodeTrigger, Int32? StationId = null, Boolean useTimer = true)
{
_logger = NLogHelper.CreateOrGetLogger("ProductionUI");
ChildName = ctrName;
SlotNr = slotNR;
SlotInfo = SlotNr.ToString();
if (useTimer)
{
tmrAutoDetect = new Timer(intervalWithoutDetect);
tmrAutoDetect.Elapsed += TmrAutoDetect_Elapsed;
tmrAutoDetect.Enabled = true;
}
BarcodeTrigger = barcodeTrigger;
}
public void TmrAutoDetect_Elapsed(Object sender, EventArgs e)
{
CurrentSlotState = SlotState.IsDetecting;
tmrAutoDetect.Enabled = false;
var hasDetect = Detect(SlotNr);
if (hasDetect)
{
CurrentSlotState = SlotState.Detected;
tmrAutoDetect.Interval = intervalWithDetect;
}
else
{
tmrAutoDetect.Interval = intervalWithoutDetect;
}
tmrAutoDetect.Enabled = true;
}
public void TextForceUpdate()
{
var hasDetect = Detect(SlotNr);
if (hasDetect)
{
CurrentSlotState = SlotState.Detected;
}
}
public virtual void InputText(String text)
{
Order = text;
}
public void Log(String txt)
{
_logger?.Info(txt);
}
public abstract Boolean SlotIsLocked();
public event EventHandler MeterDetectedHandler;
private Boolean Detect(Int32 slot)
{
if (!SlotIsLocked())
{
Log("Start Detect");
Boolean hasDetect = false;
if (string.IsNullOrEmpty(CurrentPcbID) || CurrentMeter == null)
{
Batch = new MeterBatch();
var tryMeter = new GenesisMeter();
try
{
tryMeter.SetupFromConfigFile(slot);
Batch.AddMeter(tryMeter);
tryMeter.Logout();
Log("Try to get PcbID");
CurrentPcbID = tryMeter.GetPcbId();
hasDetect = !string.IsNullOrEmpty(CurrentPcbID);
CurrentMeter = tryMeter;
if (hasDetect)
{
Log($"New PcbID detected {CurrentPcbID}");
MeterDetectedHandler?.Invoke(CurrentMeter, EventArgs.Empty);
}
else
{
Log("No Meter found");
DisposeAllConnections();
}
}
catch (Exception e)
{
Log($"Error occur.{ Environment.NewLine} {e.Message}");
}
}
else
{
Log("Check if Meter is still connected");
var ret = CurrentMeter.GetPcbId();
if (string.IsNullOrEmpty(ret) || ret != CurrentPcbID)
{
Log("Meter connection lost");
hasDetect = false;
DisposeAllConnections();
CurrentPcbID = "";
}
else
{
Log("Meter is still connected");
hasDetect = true;
}
}
return hasDetect;
}
Log("Meter is still connected (locked)");
return true;
}
private void DisposeAllConnections()
{
MeterDetectedHandler?.Invoke(null, EventArgs.Empty);
if (Batch != null)
{
Batch.RemoveAllMeters();
if (CurrentMeter != null)
{
CurrentMeter.Dispose();
}
Batch.Dispose();
}
}
public void Dispose()
{
DisposeAllConnections();
}
}
}
@@ -1,516 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO.Ports;
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.Hardware.WaterMeter.WaterMeterCore.Consts;
using Xylem.Common.Logic.SoftwareAccessHelper;
namespace Xylem.Common.Production.ProductionUiCordonel.Model
{
internal class MultiModeMasterViewModel : INotifyPropertyChanged
{
private String pickingState = "Warte auf Scanner";
private String pickingScanner = "keine Verbindung";
private String pickingSlot = "-";
private String pickingResult = "-";
private Brush pickingResultColor;
public Brush PickingResultColor
{
get => pickingResultColor;
set
{
pickingResultColor = value;
NotifyPropertyChanged();
}
}
public String PickingState
{
get => pickingState;
set
{
pickingState = value;
NotifyPropertyChanged();
}
}
public String PickingScanner
{
get => pickingScanner;
set
{
pickingScanner = value;
NotifyPropertyChanged();
}
}
public String PickingSlot
{
get => pickingSlot;
set
{
pickingSlot = value;
NotifyPropertyChanged();
}
}
public String PickingResult
{
get => pickingResult;
set
{
pickingResult = value;
NotifyPropertyChanged();
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public void StartPicking(CancellationTokenSource cancle)
{
var s = new Task(() => { PickingLoop(cancle.Token); }, cancle.Token);
s.Start();
}
public enum PickingStateMachine
{
Init,
WaitForScanning,
ScanningDone,
WaitForDetect,
GetOrderDetails,
Compare,
MeterDone,
MeterError,
StartCom,
WaitForBuildingMeterReady,
WaitForBuildingPressureReady,
}
private PickingStateMachine sm = PickingStateMachine.Init;
private class BarScanner : IDisposable
{
private Boolean isRuning;
public String Input = "";
private String Port;
private CancellationToken Cancellation;
private Task WaitForScannerTask;
public BarScanner(String port, CancellationToken cancellation)
{
Port = port;
Cancellation = cancellation;
}
public void Start()
{
if (!isRuning)
{
if (Port == null)
{
return;
}
WaitForScannerTask = new Task(() =>
{
using (var a = new SerialPort(Port))
{
a.Open();
a.NewLine = "\r";
while (true)
{
if (Cancellation.IsCancellationRequested)
{
isRuning = false;
break;
}
Input = a.ReadLine();
a.Close();
isRuning = false;
break;
}
}
}, Cancellation);
WaitForScannerTask.Start();
}
}
public void Dispose()
{
if (WaitForScannerTask.Status != TaskStatus.Faulted && WaitForScannerTask.Status != TaskStatus.RanToCompletion && WaitForScannerTask.Status != TaskStatus.Canceled)
{
WaitForScannerTask.Dispose();
}
}
}
public Boolean Compare(Dictionary<UInt32, UInt32> checkAppsIdVersion, UInt32 Frequency, UInt32 MeterSize, Boolean PressurePresent)
{
using (var Batch = new MeterBatch())
{
using (var meter = new GenesisMeter())
{
meter.SetupFromConfigFile(PickingSlotNr);
Batch.AddMeter(meter);
PickingState = "Am Zähler anmelden";
if (meter.Login())
{
meter.SetProcessState(DisplayCodes.PickingStarted);
var ret = RunCheck(checkAppsIdVersion, Frequency, MeterSize, PressurePresent, meter);
if (ret)
{
meter.SetProcessState(DisplayCodes.PickingTested);
var url = $"{ServiceUrls.MeterProcessStateUrl()}SetPickingState?PcbID={meter.PcbId}&FertigungsauftragsNr={PickingOrder}";
var RetString = LocalWebRequest.PostRequestAsyncAndGetContent(url);
var result = false;
if (bool.TryParse(RetString, out result))
{
return result;
}
}
else
{
meter.SetProcessState(DisplayCodes.PickingFailed);
}
}
}
}
return false;
}
private Boolean RunCheck(Dictionary<UInt32, UInt32> checkAppsIdVersion, UInt32 Frequency, UInt32 MeterSize, Boolean PressurePresent, GenesisMeter meter)
{
PickingState = "Üperprüfe Parameter";
var FrequencyReadOut = RegisterConverter.ByteArrayToValue<UInt32>(meter.ReadRegister("SENSUSRADIO_FrequencyIndicator"));
if (FrequencyReadOut != Frequency)
{
PickingState = $"Falsche Frequenz! soll {Frequency}MHz ist {FrequencyReadOut}MHz";
return false;
}
var MeterSizeReadOut = RegisterConverter.ByteArrayToValue<UInt32>(meter.ReadRegister("GENESISFLOW_MeterSize"));
if (MeterSizeReadOut != MeterSize)
{
PickingState = $"Meter Dn falsch! soll {MeterSize}DN ist {MeterSizeReadOut}DN";
return false;
}
var PressureReadOut = RegisterConverter.ByteArrayToValue<Boolean>(meter.ReadRegister("METROLOGYASST_PressurePresent"));
if (PressureReadOut != PressurePresent)
{
if (PressurePresent)
{
PickingState = "Pcb mit Drucksensor. Laut Auftrag keine verbaut";
}
else
{
PickingState = "Pcb ohne Drucksensor. Laut Auftrag soll eine verbaut werden";
}
//todo raus
return false;
}
foreach (var item in checkAppsIdVersion)
{
try
{
var MeterFWApp = meter.MeterAppListVersion.First(a => item.Key == a.AppId);
if (MeterFWApp == null || MeterFWApp.Version != item.Value)
{
PickingState = "Falsche FW, bitte Updaten";
return false;
}
}
catch (Exception)
{
PickingState = "Fehler beim auslesen der FW";
return false;
}
}
try
{
meter.WriteRegister("METROLOGYASST_StoreConfiguration", 1);
Thread.Sleep(100);
var storeRet = meter.ReadRegister("METROLOGYASST_StoreConfiguration");
if (!storeRet.All(a => a.Equals(0)))
{
PickingState = "Filesystem corrupt";
return false;
}
}
catch (Exception)
{
PickingState = "Fehler beim überprüfen des Filesystems";
return false;
}
return true;
}
private PickingCompareItem PickingOrderDetails;
private BarScanner PickingBarScanner;
private String PickingOrder;
private String PickingPcbId;
private String PickingScannerPort = "COM6";
private Int32 PickingSlotNr = 1;
//PickingState,PickingScanner,PickingSlot,PickingResult
private void PickingLoop(CancellationToken token)
{
while (!token.IsCancellationRequested)
{
switch (sm)
{
case PickingStateMachine.Init:
PickingState = "Initialisierung";
PickingSlot = $"Inaktiv EP {PickingSlotNr}";
PickingScanner = $"Geschlossen {PickingScannerPort}";
//CheckAllPorts?
sm = PickingStateMachine.StartCom;
break;
case PickingStateMachine.StartCom:
PickingOrderDetails = null;
PickingScanner = $"Öfffne {PickingScannerPort}";
//CheckAllPorts?
PickingBarScanner = new BarScanner(PickingScannerPort, token);
PickingBarScanner.Start();
sm = PickingStateMachine.WaitForScanning;
break;
case PickingStateMachine.WaitForScanning:
PickingScanner = $"Offen {PickingScannerPort}";
PickingState = $"Warte auf Scannereingabe({PickingScannerPort})";
if (PickingBarScanner != null && !string.IsNullOrEmpty(PickingBarScanner.Input))
{
PickingOrder = PickingBarScanner.Input;
PickingScanner = $"Geschlossen {PickingScannerPort}";
PickingBarScanner = null;
sm = PickingStateMachine.WaitForDetect;
}
break;
case PickingStateMachine.WaitForDetect:
using (var Batch = new MeterBatch())
{
using (var tryMeter = new GenesisMeter())
{
try
{
PickingState = "Warte auf Pcb";
PickingSlot = $"Öffne EP {PickingSlotNr}";
tryMeter.SetupFromConfigFile(PickingSlotNr);
Batch.AddMeter(tryMeter);
tryMeter.Logout();
Log("Try to get PcbID");
PickingPcbId = tryMeter.GetPcbId();
var hasDetect = !string.IsNullOrEmpty(PickingPcbId);
if (hasDetect)
{
PickingState = $"Pcb gefunden {PickingPcbId}";
Log($"New PcbID detected {PickingPcbId}");
sm = PickingStateMachine.GetOrderDetails;
}
else
{
PickingSlot = $"Keine Konnektivität EP {PickingSlotNr}";
Log("No Meter found");
}
}
catch (Exception e)
{
Log($"Error occur.{ Environment.NewLine} {e.Message}");
}
}
}
break;
case PickingStateMachine.GetOrderDetails:
PickingState = $"Lade Auftragsdaten {PickingOrder}";
var retCode = 0;
var str = LocalWebRequest.GetRequestWithError($"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetOrderOverview?ProductionOrderNumber={PickingOrder}&CheckPcbId={PickingPcbId}", out retCode, 15000);
if (retCode == 417)
{
sm = PickingStateMachine.MeterError;
PickingResult = "Keine Radio Parameter";
}
else
{
var retStr = JsonConvert.DeserializeObject<OrderOverViewCordonelWithPicking>(str);
PickingOrderDetails = retStr.PickingCompareItem;
if (retStr.OrderOverViewCordonel.Count == retStr.OrderOverViewCordonel.AssignedPicking)
{
PickingResult = "Auftrag schon komplett";
sm = PickingStateMachine.MeterError;
}
else
{
PickingState = $"Auftragsdaten geladen {PickingOrder}";
sm = PickingStateMachine.Compare;
}
}
break;
case PickingStateMachine.Compare:
//Compare
PickingState = $"Vergleiche Auftragsdaten {PickingOrder} mit Pcb Eigenschaften";
var converter = new BrushConverter();
if (Compare(PickingOrderDetails.CheckAppsIdVersion, PickingOrderDetails.FrequencyIndicator, PickingOrderDetails.MeterSize, PickingOrderDetails.PressurePresent))
{
//erfolg anzeigen und weiter
var b = (Brush)converter.ConvertFromString("#419C14");
b.Freeze();
PickingResultColor = b;
sm = PickingStateMachine.MeterDone;
}
else
{
sm = PickingStateMachine.MeterError;
var b = (Brush)converter.ConvertFromString("#FF8000");
b.Freeze();
PickingResultColor = b;
}
break;
case PickingStateMachine.MeterError:
PickingOrderDetails = null;
PickingState = "Vergleich abgeschlossen";
PickingResult = "Vergleich fertig fehlgeschlagen";
Thread.Sleep(10000);
sm = PickingStateMachine.StartCom;
break;
case PickingStateMachine.MeterDone:
PickingState = "Vergleich abgeschlossen warten auf Montage Rückmeldung";
PickingResult = $"Pcb {PickingPcbId} wurde dem Auftrag {PickingOrder} hinzugefügt";
Thread.Sleep(10000);
PickingScanner = $"Öfffne {PickingScannerPort}";
PickingBarScanner = new BarScanner(PickingScannerPort, token);
PickingBarScanner.Start();
sm = PickingStateMachine.WaitForBuildingMeterReady;
//CheckAllPorts?
break;
case PickingStateMachine.WaitForBuildingMeterReady:
if (PickingBarScanner != null && !string.IsNullOrEmpty(PickingBarScanner.Input))
{
if (PickingBarScanner.Input == "%Cordonel_SAP_100%")
{
var url = ServiceUrls.MeterProcessStateUrl();
url = url + $"setSapState?PcbID={PickingPcbId}&code=100&version=1";
try
{
LocalWebRequest.PostRequestAsync(url);
}
catch (Exception ex)
{
}
if (PickingOrderDetails.PressurePresent)
{
PickingBarScanner = new BarScanner(PickingScannerPort, token);
PickingBarScanner.Start();
PickingState = "Montage Rückmeldung erhalten, Montage des Drucksensors bestätigen";
sm = PickingStateMachine.WaitForBuildingPressureReady;
}
else
{
PickingState = "Montage Rückmeldung erhalten, auftrag Scannen";
sm = PickingStateMachine.StartCom;
}
}
}
break;
case PickingStateMachine.WaitForBuildingPressureReady:
if (PickingBarScanner != null && !string.IsNullOrEmpty(PickingBarScanner.Input))
{
if (PickingBarScanner.Input == "%Cordonel_SAP_101%")
{
var url = ServiceUrls.MeterProcessStateUrl();
url = url + $"setSapState?PcbID={PickingPcbId}&code=101&version=1";
try
{
LocalWebRequest.PostRequestAsync(url);
}
catch (Exception ex)
{
}
PickingState = "Montage Rückmeldung erhalten, auftrag Scannen";
sm = PickingStateMachine.StartCom;
}
}
break;
}
Thread.Sleep(1000);
}
}
private void Log(String v)
{
//throw new NotImplementedException();
}
}
}
@@ -1,440 +0,0 @@
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.Windows;
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.WaterMeterCore.Consts;
using Xylem.Common.Logic.ProductionOrderCore.OrderData;
using Xylem.Common.Logic.SoftwareAccessHelper;
using Xylem.Common.Production.ProductionUiCordonel.Data;
using MessageBox = System.Windows.Forms.MessageBox;
namespace Xylem.Common.Production.ProductionUiCordonel.Model
{
public class PickingMultiModeViewModel : BaseMultiModeChildViewModel
{
private Boolean inputIsEnabled;
public Boolean InputIsEnabled
{
get => inputIsEnabled;
set
{
inputIsEnabled = value;
NotifyPropertyChanged();
}
}
private Boolean locked;
public PickingMultiModeViewModel(String ctrName, Int32 slotNR, List<String> barcodeTrigger, Int32? stationID = null) : base(ctrName, slotNR, barcodeTrigger, stationID, false)
{
VisibilityPicking = Visibility.Visible;
MeterDetectedHandler += PickingMultiModeViewModel_MeterDetectedHandler;
}
private void PickingMultiModeViewModel_MeterDetectedHandler(Object sender, EventArgs e)
{
}
public override Boolean SlotIsLocked()
{
return locked;
}
public override void InputText(String text)
{
Order = text;
ReloadData();
TextForceUpdate();
}
internal void ReloadData()
{
Task.Run((Action)(() =>
{
try
{
if (!locked && !string.IsNullOrEmpty(Order) && Order.Length > 6 && int.TryParse(Order, out var orderNR))
{
var str = LocalWebRequest.GetRequest($"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetOrderOverview?ProductionOrderNumber={orderNR}");
var OrderOverView = JsonConvert.DeserializeObject<OrderOverViewCordonel>(str);
var doneCount = OrderOverView.AssignedPicking;
if (OrderOverView.Count == OrderOverView.AssignedPicking)
{
UpdatePickingUi("Order is already completed", StatusColor, "Input a new order number", 0, 0);
locked = false;
return;
}
str = LocalWebRequest.GetRequestWithError($"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetOrderDetails?ProductionOrderNumber={orderNR}&CheckPcbId={CurrentMeter.PcbId}", out var retCode, 15000);
if (retCode == 417)
{
MessageBox.Show(@"NO radio parameter found");
}
if (OrderOverView.Count == OrderOverView.AssignedPicking)
{
UpdatePickingUi("Order is already completed", StatusColor, "Input a new order number", 0, 0);
locked = false;
return;
}
var OrderDteails = JsonConvert.DeserializeObject<PickingCompareItem>(str);
if (CurrentMeter != null)
{
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)
{
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);
}
catch (Exception ex)
{
Log(ex.Message);
}
finally
{
locked = false;
}
}
}
else
{
UpdatePickingUi("Please input a valid order number", StatusColor, "no valid order!", 0, 0);
}
}
catch (Exception ex)
{
Log(ex.Message);
}
}));
}
private void UpdatePickingUi(String state, Brush StateColor, String order, Int32 toDo, Int32 done)
{
Message = state;
Order = order;
ToDo = toDo;
Done = done;
OnUpdateUi?.Invoke(null, EventArgs.Empty);
//if (true)
//{
//}
// lblStatus.Content = state;
// lblStatus.Background = StateColor;
// lblPickingOrder.Content = $"{Order}({Done}/{toDo}";
// txtHiddenInput.Focus();
// if (Done > 0 && Done >= toDo)
// {
// MessageBox.Show("Order is Finish");
// txtOrderNr.Text = "";
// lblStatus.Content = "Please input a new order number";
// }
//}));
}
//private void RefreshPicking()
//{
// tbarOrder.Visibility = Visibility.Visible;
// if (!string.IsNullOrEmpty(txtOrderNr.Text))
// {
// lblPickingOrder.Content = orderString;
// }
// else
// {
// UpdatePickingUi("Please input a valid order number", PickingData.StatusColor, "no valid order!", 0, 0);
// }
//}
public event EventHandler OnDataChanged;
public event EventHandler OnUpdateUi;
public new event PropertyChangedEventHandler PropertyChanged;
private GenesisMeter currentMeter;
public ObservableCollection<IPickingResultData> Data
{
get; set;
}
private OverallStatus status = OverallStatus.NoDetect;
private OverallStatus Status
{
get => status;
set
{
status = value;
OnDataChanged?.Invoke(value.GetHashCode(), EventArgs.Empty);
}
}
public String Message
{
get; set;
}
private enum OverallStatus
{
NoDetect,
CheckingIsRunning,
CheckingIsDone,
CheckingIsNoMatch,
CheckingIsHasError,
}
public String StatusText
{
get
{
switch (Status)
{
case OverallStatus.NoDetect:
return "Wait for meter";
case OverallStatus.CheckingIsRunning:
return "Is checking, please wait";
case OverallStatus.CheckingIsDone:
return "Succsesfull check next Pcb";
case OverallStatus.CheckingIsNoMatch:
return "Check has mismatch, this PCB cannot be used!";
default:
return "Check has errors, this PCB cannot be used!";
}
}
}
public Brush StatusColor
{
get
{
switch (Status)
{
case OverallStatus.NoDetect:
return (SolidColorBrush)new BrushConverter().ConvertFromString("White");
case OverallStatus.CheckingIsRunning:
return (SolidColorBrush)new BrushConverter().ConvertFromString("Yellow");
case OverallStatus.CheckingIsDone:
return (SolidColorBrush)new BrushConverter().ConvertFromString("Green");
case OverallStatus.CheckingIsNoMatch:
return (SolidColorBrush)new BrushConverter().ConvertFromString("Red");
default:
return (SolidColorBrush)new BrushConverter().ConvertFromString("DarkRed");
}
}
}
public Int32 ToDo
{
get; private set;
}
public Int32 Done
{
get; private set;
}
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
{
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 = "-"
});
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 = "Pressure",
CheckText = "Pressure Sensor", CompareObject = PressurePresent, CurrentValueText = "-", HasError = false,
Result = null, RegisterIdent = "METROLOGYASST_PressurePresent"
});
foreach (var item in checkAppsIdVersion)
{
data.Add(new PickingResultCustomCheckData(delegate
{
try
{
var MeterFWApp = meter.MeterAppListVersion.First(a => item.Key == a.AppId);
if (MeterFWApp.Version != item.Value)
{
return new PickingItemCheckReturn { Result = false, Msg = MeterFWApp.StrVersion };
}
return new PickingItemCheckReturn { Result = true, Msg = MeterFWApp.StrVersion };
}
catch (Exception)
{
return new PickingItemCheckReturn { Result = false, Msg = "error" };
}
})
{
Index = data.Count, Ident = $"Check AppId {item.Key}", CheckText = $"Version {item.Value}",
HasError = false, Result = null, CurrentValueText = "-"
});
}
data.Add(new PickingResultCustomCheckData(delegate
{
try
{
meter.WriteRegister("METROLOGYASST_StoreConfiguration", 1);
Thread.Sleep(100);
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 = false, Msg = "Filesystem corrupt" };
}
catch (Exception)
{
return new PickingItemCheckReturn { Result = false, Msg = "error" };
}
})
{
Index = data.Count, Ident = "Check Filesystem", CheckText = "Check Filesystem", HasError = false,
Result = null, CurrentValueText = "checking"
});
Status = OverallStatus.CheckingIsRunning;
ChangeDataData(data);
}
private void ChangeDataData(List<IPickingResultData> data)
{
Data = new ObservableCollection<IPickingResultData>(data);
OnDataChanged?.Invoke(Data, EventArgs.Empty);
}
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))
{
var result = item.Action.Invoke();
item.Result = result.Result;
item.CurrentValueText = result.Msg;
ChangeDataData(tmpData);
}
if (tmpData.All(a => !a.HasError && a.Result.HasValue && a.Result.Value))
{
currentMeter.SetProcessState(DisplayCodes.PickingTested);
var url = $"{ServiceUrls.MeterProcessStateUrl()}SetPickingState?PcbID={pcbID}&FertigungsauftragsNr={OrderNr}";
var RetString = LocalWebRequest.PostRequestAsyncAndGetContent(url);
if (bool.TryParse(RetString, out var result))
{
Status = OverallStatus.CheckingIsDone;
return result;
}
Status = OverallStatus.CheckingIsHasError;
return false;
}
currentMeter.SetProcessState(DisplayCodes.PickingFailed);
if (tmpData.All(a => a.HasError))
{
Status = OverallStatus.CheckingIsHasError;
}
else
{
Status = OverallStatus.CheckingIsNoMatch;
}
return false;
}
internal void Empty()
{
Status = OverallStatus.NoDetect;
ChangeDataData(new List<IPickingResultData>());
}
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
{
PropertyChanged?.Invoke(this, e);
}
}
}
@@ -1,221 +0,0 @@
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 Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
using Xylem.Common.Logic.SoftwareAccessHelper;
using Xylem.Common.Production.ProductionUiCordonel.Data;
namespace Xylem.Common.Production.ProductionUiCordonel.Model
{
public class PickingViewModel : INotifyPropertyChanged
{
public event EventHandler OnDataChanged;
public event PropertyChangedEventHandler PropertyChanged;
private GenesisMeter currentMeter;
private PickingCompareItem baseFile;
public ObservableCollection<IPickingResultData> Data { get; set; }
private OverallStatus status = OverallStatus.NoDetect;
private OverallStatus Status
{
get => status;
set
{
status = value;
OnDataChanged?.Invoke(value.GetHashCode(), EventArgs.Empty);
}
}
private enum OverallStatus
{
NoDetect,
CheckingIsRunning,
CheckingIsDone,
CheckingIsNoMatch,
CheckingIsHasError,
}
public String StatusText
{
get
{
switch (Status)
{
case OverallStatus.NoDetect:
return "Wait for meter";
case OverallStatus.CheckingIsRunning:
return "Is checking, please wait";
case OverallStatus.CheckingIsDone:
return "Succsesfull check next Pcb";
case OverallStatus.CheckingIsNoMatch:
return "Check has mismatch, this PCB cannot be used!";
default:
return "Check has errors, this PCB cannot be used!";
}
}
}
public Brush StatusColor
{
get
{
switch (Status)
{
case OverallStatus.NoDetect:
return (SolidColorBrush)new BrushConverter().ConvertFromString("White");
case OverallStatus.CheckingIsRunning:
return (SolidColorBrush)new BrushConverter().ConvertFromString("Yellow");
case OverallStatus.CheckingIsDone:
return (SolidColorBrush)new BrushConverter().ConvertFromString("Green");
case OverallStatus.CheckingIsNoMatch:
return (SolidColorBrush)new BrushConverter().ConvertFromString("Red");
default:
return (SolidColorBrush)new BrushConverter().ConvertFromString("DarkRed");
}
}
}
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
{
var r = 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 = "-" });
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 = "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
{
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 = true, Msg = MeterFWApp.StrVersion };
}
catch (Exception)
{
return new PickingItemCheckReturn { Result = false, Msg = "error" };
}
})
{ Index = data.Count, Ident = $"Check AppId {item.Key}", CheckText = $"Version {item.Value}", HasError = false, Result = null, CurrentValueText = "-" }); ;
}
data.Add(new PickingResultCustomCheckData(delegate
{
try
{
meter.WriteRegister("METROLOGYASST_StoreConfiguration", 1);
Thread.Sleep(100);
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 = false, Msg = "Filesystem corrupt" };
}
catch (Exception)
{
return new PickingItemCheckReturn { Result = false, Msg = "error" };
}
})
{ Index = data.Count, Ident = "Check Filesystem", CheckText = "Check Filesystem", HasError = false, Result = null, CurrentValueText = "checking" }); ;
Status = OverallStatus.CheckingIsRunning;
ChangeDataData(data);
}
private void ChangeDataData(List<IPickingResultData> data)
{
Data = new ObservableCollection<IPickingResultData>(data);
OnDataChanged?.Invoke(Data, EventArgs.Empty);
}
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))
{
var result = item.Action.Invoke();
item.Result = result.Result;
item.CurrentValueText = result.Msg;
ChangeDataData(tmpData);
}
if (tmpData.All(a => !a.HasError && a.Result.HasValue && a.Result.Value))
{
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))
{
Status = OverallStatus.CheckingIsDone;
return result;
}
Status = OverallStatus.CheckingIsHasError;
return false;
}
currentMeter.SetProcessState(DisplayCodes.PickingFailed);
if (tmpData.All(a => a.HasError))
{
Status = OverallStatus.CheckingIsHasError;
}
else
{
Status = OverallStatus.CheckingIsNoMatch;
}
return false;
}
internal void Empty()
{
Status = OverallStatus.NoDetect;
ChangeDataData(new List<IPickingResultData>());
}
}
}
@@ -1,192 +0,0 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using Newtonsoft.Json;
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;
using Xylem.Common.Production.ProductionUiCordonel.Data;
using Xylem.Common.Production.ProductionUiCordonel.Event;
namespace Xylem.Common.Production.ProductionUiCordonel.Model
{
public class PressureMultiModeViewModel : BaseMultiModeChildViewModel
{
public event EventHandler<StringArgs> OnStoreDone;
private PressureResultDataNotifyable result = new PressureResultDataNotifyable();
public PressureResultDataNotifyable Result
{
get => result;
set
{
result = value;
NotifyPropertyChanged();
}
}
private Boolean inputIsEnabled;
public Boolean InputIsEnabled
{
get => inputIsEnabled;
set
{
inputIsEnabled = value;
NotifyPropertyChanged();
}
}
public Boolean Locked { get; set; } = false;
public Int32? StationID { get; set; }
public PressureMultiModeViewModel(String ctrName, Int32 slotNR, List<String> barcodeTrigger, Int32? stationID = null) : base(ctrName, slotNR, barcodeTrigger, stationID)
{
VisibilityPressure = Visibility.Visible;
StationID = stationID;
}
public Boolean isHydraulicStaion()
{
if (!StationID.HasValue || StationID.Value == 1)
{
return false;
}
return true;
}
public override Boolean SlotIsLocked()
{
return false;
}
internal void ReloadData(Boolean reset)
{
if (Result != null && Result.PcbId != CurrentPcbID)
{
InputIsEnabled = false;
if (true)
{
}
Result = new PressureResultDataNotifyable { Remark = "loading", Testpoints = new ObservableCollection<PressureTestPoints>(), PcbId = "" };
Task.Run((Func<PressureResultDataNotifyable>)(() =>
{
try
{
var url = ServiceUrls.MeterProcessStateUrl();
url = url + $"GetPressureStateDetailed?PcbId={CurrentPcbID}&TopCount=1";
var retStr = LocalWebRequest.GetRequest(url);
var pressureResultData = JsonConvert.DeserializeObject<List<PressureResultData>>(retStr);
if (!pressureResultData.Any())
{
return new PressureResultDataNotifyable();
}
return new PressureResultDataNotifyable(pressureResultData.First());
}
catch (Exception ex)
{
Log(ex.Message);
return new PressureResultDataNotifyable();
}
})).ContinueWith(a =>
{
var res = a.Result;
res.PcbId = CurrentPcbID;
Result = res;
InputIsEnabled = true;
}
);
}
}
internal void StoreData(Boolean successfull)
{
if (Result != null && Result.PcbId == CurrentPcbID)
{
InputIsEnabled = false;
var isStored = false;
var status = DisplayCodes.PressureTestedFailed;
Task.Run((Action)(() =>
{
var url = ServiceUrls.MeterProcessStateUrl();
if (successfull)
{
status = DisplayCodes.PressureTested;
}
try
{
if (StationID == 1)
{
var addResult = new PressureTestResult
{
FreeText = Result.Remark,
Passed = successfull,
StationId = StationID
};
url = url + $"SetPressureState?PcbId={CurrentPcbID}&FertigungsauftragsNr=0";
if (!LocalWebRequest.PostRequestAsync(url, json: addResult))
{
throw new ApplicationException("PressureState: NOT successful");
}
}
else
{
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 = DisplayCodes.PressureTestedFailed;
}
}
CurrentMeter.Login();
CurrentMeter.SetProcessState(status);
}
catch (Exception ex)
{
Log(ex.Message);
status = DisplayCodes.PressureTestedFailed;
OnStoreDone?.Invoke(null, new StringArgs("Can not store Result"));
}
if (status == DisplayCodes.PressureTested)
{
OnStoreDone?.Invoke(null, new StringArgs("Pressure test stored successfully. Meter can passed"));
return;
}
OnStoreDone?.Invoke(null, new StringArgs("Pressure test stored successfully. But Meter is marked with a leakage. Please inform QS"));
}));
}
}
}
}
@@ -2,7 +2,6 @@
using Newtonsoft.Json.Linq;
using SIRTCOM;
using System;
using System.Configuration;
using System.Linq;
using System.Net;
using System.Threading;
@@ -10,6 +9,7 @@ using System.Windows.Threading;
using System.Xml.Linq;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.CommonCore.Consts;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Logic.ProductionOrderCore;
using Xylem.Common.Logic.SoftwareAccessHelper;
@@ -18,6 +18,7 @@ using Xylem.Common.Production.ProductionUiCordonel.Properties;
using Xylem.Common.Production.ProductionUiCordonel.UserControls;
using Xylem.Common.Utils.Logging;
using Button = System.Windows.Controls.Button;
// ReSharper disable UnusedAutoPropertyAccessor.Local
namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolProcesses
@@ -104,7 +105,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
/// <summary>
/// Comport number of SIRT
/// </summary>
private Byte _sirtComport;
private Int32 _sirtComport;
/// <summary>
/// Radio address Cordonel
@@ -127,10 +128,6 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
{
Retry();
};
//_checkRadioUserControl.OnDoneRequested += delegate
//{
// SaveRssiLevelsToDb();
//};
}
/// <summary>
@@ -181,6 +178,9 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
/// <remarks date="2025-Mai-07" author="Thomas Wiedebusch">
/// - Removed change and read back of MainAlarmMask and ExtendedAlarmMask.
/// </remarks>
/// <remarks date="2025-Sep-10" author="Thomas Wiedebusch">
/// - Load settings from SIRT config file instead from AppConfig.
/// </remarks>
public override StatusReturn ExecuteProcess()
{
// This will force to reset all values, Sentinel and Prepare shipping will fail based on EOL Progress
@@ -269,9 +269,22 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
SuccessMsgDispatcher(Resources.StrSuccessMsgDbToMeterEncryptionKey);
ActualProcessProgress++;
_sirtComport = Convert.ToByte(ConfigurationManager.AppSettings[$"SirtComport{freq}"]);
//_sirtSecondComport = Convert.ToByte(ConfigurationManager.AppSettings[$"SirtComportAlarm{freq}"]);
_sirtBoxNr = Convert.ToByte(ConfigurationManager.AppSettings["SirtBoxNr"]);
// Load settings from SIRT config file
var sirtConfig = new SirtConfig();
sirtConfig.ReadSirtConfig();
if (freq == 433 && sirtConfig.SirtComport433MHz != null)
{
int.TryParse(sirtConfig.SirtComport433MHz.Replace("COM", ""), out _sirtComport);
}
if (freq == 868 && sirtConfig.SirtComport433MHz != null)
{
int.TryParse(sirtConfig.SirtComport868MHz.Replace("COM", ""), out _sirtComport);
}
if (sirtConfig.SirtBoxNo != null)
_sirtBoxNr = (Byte)sirtConfig.SirtBoxNo;
var ucRadio = (UcRadioCheck)UserControl;
ucRadio.SetHeadline($"{Resources.StrStateRadioCheck} BOX: {_sirtBoxNr}");
@@ -329,100 +342,6 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
SuccessMsgDispatcher(Resources.StrSuccessMsgRadioInCustomerMode);
//// Initialize the SIRT
//if (!SirtInit())
//{
// return SetTestFailed(Resources.StrErrorMsgSirt);
//}
////Radio rest alarms
////readout wakeup, interval
////start process
////wait for process exit code
//var WakUpRestore = RegisterConverter.ByteArrayToValue<ushort>(Meter.ReadRegister("SENSUSRADIO_WakeupInterval"));
//var TxIntervalRestore = RegisterConverter.ByteArrayToValue<UInt16>(Meter.ReadRegister("SENSUSRADIO_TxInterval"));
//var LatRestore = RegisterConverter.ByteArrayToValue<ushort>(Meter.ReadRegister("SENSUSRADIO_LatInterval"));
//WriteRegisterLogAndProcessCtr(new ProgrammingParameters("SENSUSRADIO_WakeupInterval",
//new Byte[] { 0x00 }, ProgrammingSource.ProgramInternal));
//WriteRegisterLogAndProcessCtr(new ProgrammingParameters("SENSUSRADIO_TxInterval",
//new Byte[] { 0x01 }, ProgrammingSource.ProgramInternal));
//WriteRegisterLogAndProcessCtr(new ProgrammingParameters("SENSUSRADIO_LatInterval", RegisterConverter.ValueToByteArray(3), ProgrammingSource.ProgramInternal));
//Meter.Logout();
//var process = new Process
//{
// EnableRaisingEvents = true,
// StartInfo = new ProcessStartInfo
// {
// Arguments = $"COM{_sirtSecondComport} {_radioAddressCordonel} {_radioEncryptionKey}",
// FileName = @"\\sla12file\auftrag\ProductionUiCordonel\CommonConsoleV2\CommonConsole.exe",
// CreateNoWindow = true,
// UseShellExecute = false,
// RedirectStandardError = true,
// RedirectStandardOutput = true
// }
//};
//void logData(string data, bool error)
//{
// if (!string.IsNullOrWhiteSpace(data))
// {
// if (error)
// {
// ErrorMsgDispatcher(data.Trim());
// }
// else
// {
// SuccessMsgDispatcher(data.Trim());
// }
// }
//}
//process.ErrorDataReceived += (_, args) => logData(args.Data, true);
//process.OutputDataReceived += (_, args) => logData(args.Data, false);
//process.Start();
//process.BeginOutputReadLine();
//process.BeginErrorReadLine();
//process.WaitForExit(80_000);
//if (process.ExitCode != 0)
//{
// ErrorMsgDispatcher($"AlarmReset failed ExitCode{process.ExitCode}");
// return SetTestFailed($"AlarmReset failed ExitCode{process.ExitCode}");
//}
////restore
//// reset system state back to shipping mode
//Meter.Login();
//WriteRegisterLogAndProcessCtr(new ProgrammingParameters("SENSUSRADIO_WakeupInterval", RegisterConverter.ValueToByteArray(WakupRestore) , ProgrammingSource.ProgramInternal));
//WriteRegisterLogAndProcessCtr(new ProgrammingParameters("SENSUSRADIO_TxInterval", RegisterConverter.ValueToByteArray(TxIntervalRestore), ProgrammingSource.ProgramInternal));
//WriteRegisterLogAndProcessCtr(new ProgrammingParameters("SENSUSRADIO_LatInterval", RegisterConverter.ValueToByteArray(LatRestore), ProgrammingSource.ProgramInternal));
//WriteRegisterLogAndProcessCtr(new ProgrammingParameters("SENSUSRADIO_SystemState",
// new Byte[] { 0xFF }, ProgrammingSource.ProgramInternal));
//ActualProcessProgress++;
//_finalRadioSystemState = RegisterConverter.ByteArrayToValue<Byte>(Meter.ReadRegister("SENSUSRADIO_SystemState"));
//ActualProcessProgress++;
//if (// radio system state 0x02 shipping mode, 0x01 production mode, 0x0C transmission and data logger active
// _finalRadioSystemState != 0x02
// // If radio check is enabled the signal level has to be in range and the test has to be finished
// || (!skipRadioCheck && (!_successSignalLevel || !_sirtComOkay || !_testFinished)))
//{
// return SetTestFailed(!_sirtComOkay ? Resources.StrErrorMsgSirt : Resources.StrErrorMsgRadioCheck);
//}
// Skip radio check by requirement
if (skipRadioCheck)
{
@@ -945,14 +864,19 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
/// <remarks date="2025-Aug-25" author="Stoyan Slatev">
/// - Initial.
/// </remarks>
/// <remarks date="2025-Sep-02" author="Thomas WIedebusch">
/// <remarks date="2025-Sep-02" author="Thomas Wiedebusch">
/// - Multilingual.
/// </remarks>
/// <remarks date="2025-Sep-10" author="Stoyan Slatev">
/// - Reworked.
/// </remarks>
private void CheckAlarmStateFromRF(params Byte[] telegram)
{
if (telegram == null) return;
try
{
var telegramLength = telegram?.Length ?? 0;
var telegramLength = telegram.Length;
if (telegramLength <= 8)
{
@@ -960,8 +884,6 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
return;
}
if (telegram == null) return;
var semiLength = Math.Min(telegram[7], (Byte)RFTelegrams.SEMI.MIN_LENGTH);
if (telegramLength < semiLength)
@@ -969,9 +891,10 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
ErrorMsgDispatcher(Resources.StrErrorMsgSemiTelegramLength);
return;
}
var mhz = RegisterConverter.ByteArrayToValue<UInt32>(Meter.ReadRegister("SENSUSRADIO_FrequencyIndicator"));
var semiBytes = new Byte[semiLength];
Array.Copy(telegram, 8, semiBytes, 0, semiLength);
Array.Copy(telegram, 8, semiBytes, 0, semiLength - 8);
var semi = new RFTelegrams.SEMI(semiBytes, (Int32)mhz);
var alarms = semi.MainAlarmByte;
@@ -101,6 +101,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
return StatusReturn.Failed;
}
}
// ReSharper disable once UnusedVariable used for DEBUG
var readBackScaledBilling =
RegisterConverter.ByteArrayToValue<Int64>(Meter.ReadRegister("GENESISFLOW_ScaledBilling"));
@@ -120,7 +121,17 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
CancellationToken);
RegisterRestorer.OnProcessUpdate -= ProcessUpdate_Handler;
// ReSharper disable once UnusedVariable used for DEBUG
readBackScaledBilling =
RegisterConverter.ByteArrayToValue<Int64>(Meter.ReadRegister("GENESISFLOW_ScaledBilling"));
// ReSharper disable once UnusedVariable used for DEBUG
readBackUnscaledFwd =
RegisterConverter.ByteArrayToValue<UInt64>(Meter.ReadRegister("GENESISFLOW_UnscaledFwd"));
// ReSharper disable once UnusedVariable used for DEBUG
readBackUnscaledRev =
RegisterConverter.ByteArrayToValue<UInt64>(Meter.ReadRegister("GENESISFLOW_UnscaledRev"));
EolProgress.ParametrizationDoneChecked = retVal == StatusReturn.Okay ? EOLStatus.OK : EOLStatus.FAIL;
return retVal;
}
@@ -162,6 +162,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
}
}
// Check all values for 0 after reset and followed reboot which may use the
var readBackScaledBilling =
RegisterConverter.ByteArrayToValue<Int64>(Meter.ReadRegister("GENESISFLOW_ScaledBilling"));
var readBackUnscaledFwd =
@@ -1,6 +1,6 @@
namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.RFTelegrams
{
public enum AppCode
public enum AppCode
{
BUP = 0x00,
LAT = 0x01,
@@ -7,7 +7,8 @@
public class SEMI
{
public const int MIN_LENGTH = 120;
//public const int MIN_LENGTH = 120;
public const int MIN_LENGTH = 97;
public SEMI(byte[] payload, int mhz)
{
@@ -54,15 +55,15 @@
this.PulseOutParameter = payload[94];
this.AlarmByteExtended = payload[95];
this.AlarmMaskExtended = payload[96];
this.AlarmMaxPressureTime = payload.ToUInt32BE(97);
this.AlarmMinPressureTime = payload.ToUInt32BE(101);
this.AlarmMaxTemperatureTime = payload.ToUInt32BE(105);
this.AlarmMinTemperatureTime = payload.ToUInt32BE(109);
this.LogContentPressureTemperature = payload.ToUInt16BE(113);
this.FDRContentPressureTemperature = payload.ToUInt16BE(115);
this.UnitExtraFlags = payload[117];
this.MeterSize = payload[118];
this.PressureCalibrationOffset = payload[119];
//this.AlarmMaxPressureTime = payload.ToUInt32BE(97);
//this.AlarmMinPressureTime = payload.ToUInt32BE(101);
//this.AlarmMaxTemperatureTime = payload.ToUInt32BE(105);
//this.AlarmMinTemperatureTime = payload.ToUInt32BE(109);
//this.LogContentPressureTemperature = payload.ToUInt16BE(113);
//this.FDRContentPressureTemperature = payload.ToUInt16BE(115);
//this.UnitExtraFlags = payload[117];
//this.MeterSize = payload[118];
//this.PressureCalibrationOffset = payload[119];
}
public AppCode AppCode { get; }
@@ -151,22 +152,22 @@
public byte AlarmMaskExtended { get; }
public uint AlarmMaxPressureTime { get; }
//public uint AlarmMaxPressureTime { get; }
public uint AlarmMinPressureTime { get; }
//public uint AlarmMinPressureTime { get; }
public uint AlarmMaxTemperatureTime { get; }
//public uint AlarmMaxTemperatureTime { get; }
public uint AlarmMinTemperatureTime { get; }
//public uint AlarmMinTemperatureTime { get; }
public ushort LogContentPressureTemperature { get; }
//public ushort LogContentPressureTemperature { get; }
public ushort FDRContentPressureTemperature { get; }
//public ushort FDRContentPressureTemperature { get; }
public byte UnitExtraFlags { get; }
//public byte UnitExtraFlags { get; }
public byte MeterSize { get; }
//public byte MeterSize { get; }
public byte PressureCalibrationOffset { get; }
//public byte PressureCalibrationOffset { get; }
}
}
@@ -140,17 +140,6 @@
<Compile Include="..\..\.shared\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="ApplicationSettings.cs" />
<Compile Include="BarcodeInput\Listener.cs" />
<Compile Include="ctls\ctlMultiModeMarriage.xaml.cs">
<DependentUpon>ctlMultiModeMarriage.xaml</DependentUpon>
</Compile>
<Compile Include="ctls\ctlMultiModePicking.xaml.cs">
<DependentUpon>ctlMultiModePicking.xaml</DependentUpon>
</Compile>
<Compile Include="ctls\ctlMultiModePressure.xaml.cs">
<DependentUpon>ctlMultiModePressure.xaml</DependentUpon>
</Compile>
<Compile Include="Model\EOLHandler.cs" />
<Compile Include="ProductionProcesses\EolProcesses\CreateEolProgress.cs" />
<Compile Include="ProductionProcesses\EolProcesses\VisualInspection.cs" />
@@ -173,16 +162,7 @@
<Compile Include="ProductionProcesses\PickingProcesses\PickingProcessStatesDef.cs" />
<Compile Include="ProductionProcesses\PickingProcesses\PrepareAssemblyRelease.cs" />
<Compile Include="ProductionProcesses\ProcessStateStruct.cs" />
<Compile Include="Data\PickingResultData.cs" />
<Compile Include="Data\PressureResultDataNotifyable.cs" />
<Compile Include="Event\StringArgs.cs" />
<Compile Include="Model\MultiModeMasterViewModel.cs" />
<Compile Include="Model\PressureMultiModeViewModel.cs" />
<Compile Include="Model\MultiModeChildViewModel.cs" />
<Compile Include="Model\MarriageMultiModeViewModel.cs" />
<Compile Include="Model\PickingMultiModeViewModel.cs" />
<Compile Include="Model\PickingViewModel.cs" />
<Compile Include="Model\IMultiModeChildViewModel.cs" />
<Compile Include="ProductionProcesses\EolProcesses\CheckSerialNumber.cs" />
<Compile Include="ProductionProcesses\EolProcesses\CheckOrderNumber.cs" />
<Compile Include="ProductionProcesses\EolProcesses\CheckAttachments.cs" />
@@ -242,18 +222,6 @@
<Compile Include="UserControls\UcPasswordFile.xaml.cs">
<DependentUpon>UcPasswordFile.xaml</DependentUpon>
</Compile>
<Page Include="ctls\ctlMultiModeMarriage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ctls\ctlMultiModePicking.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ctls\ctlMultiModePressure.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ProductionWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -141,10 +141,10 @@ namespace Xylem.Common.Production.ProductionUiCordonel
InitializeFormState();
}
private ApplicationSettings Settings
{
get; set;
}
//private ApplicationSettings Settings
//{
// get; set;
//}
/// <summary>
/// Initialize the FinalTest GUI:
@@ -183,7 +183,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel
}
cbxSlotBox.SelectedIndex = 0;
Settings = new ApplicationSettings("ProductionUiConfig.json");
//Settings = new ApplicationSettings("ProductionUiConfig.json");
UseSetting(true);
@@ -248,7 +248,8 @@ namespace Xylem.Common.Production.ProductionUiCordonel
//}
if (setSlot)
{
cbxSlotBox.SelectedValue = Settings.Slot;
//cbxSlotBox.SelectedValue = Settings.Slot;
cbxSlotBox.SelectedValue = 0;
}
}
@@ -863,10 +864,10 @@ namespace Xylem.Common.Production.ProductionUiCordonel
}
private void StoreSetting()
{
Settings.Update("ProductionUiConfig.json");
}
//private void StoreSetting()
//{
// Settings.Update("ProductionUiConfig.json");
//}
//private void BtnConnect_Click(Object sender, RoutedEventArgs e)
//{
@@ -1,29 +0,0 @@
<UserControl x:Class="Xylem.Common.Production.ProductionUiCordonel.ctls.ctlMultiModeMarriage"
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"
mc:Ignorable="d"
d:DesignHeight="150" d:DesignWidth="450">
<Grid>
<StackPanel Background="BlanchedAlmond" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100*"/>
<ColumnDefinition Width="225*"/>
</Grid.ColumnDefinitions>
<TextBox Name="TxtSerialNumber" Text="{Binding SerialNr, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Height="26" Margin="24,10,0,0" TextWrapping="Wrap" IsEnabled="False" VerticalAlignment="Top" Width="190" Grid.Column="1" Grid.Row="0"/>
<Label Content="SerialNumber" HorizontalAlignment="Left" Margin="14,10,0,0" VerticalAlignment="Top" Grid.Row="0" Height="26" Width="82"/>
<TextBox x:Name="TxtPcbId" Text="{Binding CurrentPcbID, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Height="26" Margin="24,10,0,0" IsEnabled="False" TextWrapping="Wrap" VerticalAlignment="Top" Width="190" Grid.Column="1" Grid.Row="1"/>
<Label Content="PcbId" HorizontalAlignment="Left" Margin="14,10,0,0" VerticalAlignment="Top" Grid.Row="1" Height="26" Width="40"/>
<Button Name="btnMarry" IsEnabled="{Binding CanMarry, UpdateSourceTrigger=PropertyChanged}" Grid.ColumnSpan="2" Content="Marry" Height="35" Margin="35,5,0,0" Grid.Row="2" VerticalAlignment="Top" Click="btnMarry_Click" HorizontalAlignment="Left" Width="395"/>
</Grid>
</StackPanel>
</Grid>
</UserControl>
@@ -1,47 +0,0 @@
using System;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using Xylem.Common.Production.ProductionUiCordonel.Model;
using MessageBox = System.Windows.Forms.MessageBox;
namespace Xylem.Common.Production.ProductionUiCordonel.ctls
{
/// <summary>
/// Interaction logic for ctlMultiModeMarriage.xaml
/// </summary>
public partial class ctlMultiModeMarriage : UserControl
{
private MarriageMultiModeViewModel ViewModel;
public ctlMultiModeMarriage()
{
InitializeComponent();
}
public void setViewModel(MarriageMultiModeViewModel viewModel)
{
ViewModel = viewModel;
//ViewModel.Store();
}
private void btnMarry_Click(Object sender, RoutedEventArgs e)
{
Task.Run(() =>
{
return ViewModel.Store();
}).ContinueWith(a =>
{
if (a.Result)
{
MessageBox.Show("Meter has passed");
}
else
{
MessageBox.Show("Meter not has passed");
}
});
}
}
}
@@ -1,70 +0,0 @@
<UserControl x:Class="Xylem.Common.Production.ProductionUiCordonel.ctls.ctlMultiModePicking"
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"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<StackPanel Background="BlueViolet" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="80*"/>
</Grid.ColumnDefinitions>
<Label Content="Picking Tool" Height="30" Grid.Row="0" Grid.ColumnSpan="2"></Label>
<Label Content="Order" Height="80" Grid.Row="1" Grid.Column="0"></Label>
<Label Name="lblPickingOrder" Height="80" Grid.Row="1" Grid.Column="1"></Label>
<Label Name="lblStatus" Height="80" Grid.Row="2" Grid.ColumnSpan="2"></Label>
</Grid>
<DockPanel>
<ItemsControl Name="icPicking" ItemsSource="{Binding Data}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border BorderBrush="Black" Background="{Binding ResultColor}" BorderThickness="1" Margin="2">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label Content="{Binding Ident}" Grid.Row="0" Grid.Column="0"/>
<Label Content="{Binding CheckText}" Grid.Row="0" Grid.Column="1"/>
<Label Content="{Binding CurrentValueText}" Grid.Row="0" Grid.Column="2"/>
<Label Content="{Binding Result}" Grid.Row="0" Grid.Column="3"/>
</Grid>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.Template>
<ControlTemplate TargetType="ItemsControl">
<ScrollViewer CanContentScroll="True">
<ItemsPresenter/>
</ScrollViewer>
</ControlTemplate>
</ItemsControl.Template>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</DockPanel>
</StackPanel>
</Grid>
</UserControl>
@@ -1,124 +0,0 @@
using System;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Threading;
using Xylem.Common.Production.ProductionUiCordonel.Data;
using Xylem.Common.Production.ProductionUiCordonel.Model;
namespace Xylem.Common.Production.ProductionUiCordonel.ctls
{
/// <summary>
/// Interaction logic for ctlMultiModePicking.xaml
/// </summary>
public partial class ctlMultiModePicking : UserControl
{
private PickingMultiModeViewModel ViewModel;
public ctlMultiModePicking()
{
InitializeComponent();
}
public void setViewModel(PickingMultiModeViewModel viewModel)
{
ViewModel = viewModel;
ViewModel.MeterDetectedHandler += ViewModel_MeterDetectedHandler;
viewModel.OnDataChanged += PickingData_OnDataChanged;
ViewModel.OnUpdateUi += UpdatePickingUi;
}
private void ViewModel_MeterDetectedHandler(Object sender, EventArgs e)
{
Dispatcher.Invoke(DispatcherPriority.Normal,
new Action(() =>
{
Boolean update = false;
if (sender is null)
{
ViewModel.InputIsEnabled = false;
}
else
{
var ts = DateTimeOffset.UtcNow - new DateTimeOffset(2000, 1, 1, 0, 0, 0, new TimeSpan(0));
ViewModel.CurrentMeter.Login();
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.ReloadData(false);
}
}
));
}
private void UpdatePickingUi(Object sender, EventArgs e)
{
icPicking.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
{
lblStatus.Content = ViewModel.StatusText;
lblStatus.Background = ViewModel.StatusColor;
lblPickingOrder.Content = $"{ViewModel.Order}({ViewModel.Done}/{ViewModel.ToDo}";
if (ViewModel.Done > 0 && ViewModel.Done >= ViewModel.ToDo)
{
MessageBox.Show("Order is Finish");
lblStatus.Content = "Please input a new order number";
}
}));
}
private void PickingData_OnDataChanged(Object sender, EventArgs e)
{
if (sender is ObservableCollection<IPickingResultData> newData)
{
icPicking.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => { icPicking.ItemsSource = newData; }));
}
icPicking.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => { lblStatus.Content = ViewModel.StatusText; lblStatus.Background = ViewModel.StatusColor; }));
}
//private void UpdatePickingUi(string state, System.Windows.Media.Brush StateColor, string Order, int toDo, int Done)
//{
// icPicking.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
// {
// lblStatus.Content = state;
// lblStatus.Background = StateColor;
// lblPickingOrder.Content = $"{Order}({Done}/{toDo}";
// txtHiddenInput.Focus();
// if (Done > 0 && Done >= toDo)
// {
// MessageBox.Show("Order is Finish");
// txtOrderNr.Text = "";
// lblStatus.Content = "Please input a new order number";
// }
// }));
//}
//private void PickingData_OnDataChanged(object sender, EventArgs e)
//{
// if (sender is ObservableCollection<IPickingResultData> newData)
// {
// icPicking.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => { icPicking.ItemsSource = newData; }));
// }
// icPicking.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => { lblStatus.Content = PickingData.StatusText; lblStatus.Background = PickingData.StatusColor; }));
//}
}
}
@@ -1,150 +0,0 @@
<UserControl x:Class="Xylem.Common.Production.ProductionUiCordonel.ctls.ctlMultiModePressure"
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"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="600" Background="CadetBlue" IsEnabled="{Binding InputIsEnabled, UpdateSourceTrigger=PropertyChanged}" >
<Grid>
<!--<Grid Grid.Row="8">
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
<RowDefinition Height="5*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="5*"/>
<RowDefinition Height="10*" />
<RowDefinition Height="30*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="5*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="65"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Rectangle Grid.Row="0" Grid.ColumnSpan="2" Fill="Transparent" />
<Rectangle Grid.Row="1" Grid.ColumnSpan="2" Fill="Black" />
<Rectangle Grid.Row="2" Grid.ColumnSpan="2" Fill="LightGreen" />
<Rectangle Grid.Row="3" Grid.ColumnSpan="2" Fill="LightGreen" />
<Rectangle Grid.Row="4" Grid.ColumnSpan="2" Fill="Black" />
<Rectangle Grid.Row="5" Grid.ColumnSpan="2" Fill="LightPink" />
<Rectangle Grid.Row="6" Grid.ColumnSpan="2" Fill="LightPink" />
<Rectangle Grid.Row="7" Grid.ColumnSpan="2" Fill="LightPink" />
<Rectangle Grid.Row="8" Grid.ColumnSpan="2" Fill="Black" />
<TextBox x:Name="TxtPresurePcbId" HorizontalAlignment="Left" Height="26" Margin="0,0,0,0" IsEnabled="False" TextWrapping="Wrap" Text="{Binding CurrentPcbID, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Width="268" Grid.Row="0" Grid.Column="1"/>
<Label Content="PcbId" HorizontalAlignment="Left" Margin="0,10,0,0" VerticalAlignment="Top" Grid.Row="0" Height="26" Width="40"/>
<Label Content="Presue was successful" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" HorizontalAlignment="Left" Width="630" />
<Button Name="btnPresueOk" Grid.ColumnSpan="2" Content="Pressure test successful" HorizontalAlignment="Left" Height="35" Margin="9,5,0,0" Grid.Row="3" VerticalAlignment="Top" Width="435" Click="BtnPresueOk_Click"/>
<Label Content="Presue Failed" HorizontalAlignment="Left" Width="630" Grid.Column="0" Grid.Row="5" Grid.ColumnSpan="2" />
<Label Content="Remark" HorizontalAlignment="Left" Margin="0,10,0,0" VerticalAlignment="Top" Height="26" Width="54" Grid.Column="0" Grid.Row="6" />
<TextBox x:Name="TxtPresureFailedText" HorizontalAlignment="Left" Height="102" Margin="3,10,0,0" TextWrapping="Wrap" AcceptsReturn="True" AcceptsTab="True" SpellCheck.IsEnabled="True" SpellCheck.SpellingReform="PreAndPostreform" Text="" VerticalAlignment="Top" Width="478" Grid.Row="6" Grid.Column="1"/>
<Button Name="btnPresueFailed" Grid.ColumnSpan="2" Content="Pressure test was unsuccessful" HorizontalAlignment="Left" Height="35" Margin="9,5,0,0" Grid.Row="7" VerticalAlignment="Top" Width="435" Click="BtnPresueFailed_Click" />
</Grid>-->
<Grid Grid.Row="8">
<Grid.RowDefinitions>
<RowDefinition Height="12*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="100*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="20*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120" />
<ColumnDefinition Width="180" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="200" />
</Grid.ColumnDefinitions>
<Label x:Name="lblHeadline" Content="HE-Schnüffeln" Grid.Column="0" Grid.Row="0" FontWeight="Bold" FontSize="24" Height="47" VerticalAlignment="Top" Margin="0,0,113,0" Grid.RowSpan="2" Grid.ColumnSpan="2" />
<Label x:Name="lblLeakrate" Content="Grenz-Leckrate >" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Grid.Row="0" Grid.Column="2" Height="26" Width="123" />
<TextBox x:Name="txtLeakrate" Height="26" IsEnabled="True" TextWrapping="Wrap" Text="{Binding Result.LeakRate, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Grid.Row="0" Grid.Column="3" HorizontalAlignment="Left" Width="171" TextChanged="TextBox_TextChanged"/>
<TextBox x:Name="TxtPresurePcbId" Height="26" IsEnabled="False" TextWrapping="Wrap" Text="{Binding CurrentPcbID, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" Width="150" TextChanged="TextBox_TextChanged"/>
<Label Content="PcbId" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="0" Height="26" Width="40"/>
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="2">
<TextBlock Text="Rev: "/>
<Label Content="{Binding Result.Rev, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" VerticalAlignment="Top" Height="26" Width="40"/>
</StackPanel>
<Label Content="Prüfdruck in bar" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Grid.Row="2" Grid.Column="0" Height="26" Width="113" Grid.ColumnSpan="2" />
<TextBox x:Name="txtPressure" Height="26" IsEnabled="True" TextWrapping="Wrap" Text="{Binding Result.TestPressure, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" Width="150" TextChanged="TextBox_TextChanged"/>
<TextBox x:Name="txtTester" Height="26" IsEnabled="True" TextWrapping="Wrap" Text="{Binding Result.TesterName, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left" Width="150" TextChanged="TextBox_TextChanged" />
<Label Content="Prüfer" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Grid.Row="3" Grid.Column="0" Height="26" Width="85" />
<ListView x:Name="listViewTestPotins" ItemsSource="{Binding Result.Testpoints, UpdateSourceTrigger=PropertyChanged}" Grid.Row="2" Grid.Column="2" Grid.RowSpan="4" HorizontalAlignment="left" Width="251" Margin="10,10,0,0" Grid.ColumnSpan="2" >
<ListView.View>
<GridView >
<GridViewColumn Header="Nr" >
<GridViewColumn.CellTemplate>
<DataTemplate >
<Label Content="{Binding Ident}" Height="22" FontWeight="Bold" FontSize="10" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Wert" >
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Input}" Height="22" Width="100" FontWeight="Bold" FontSize="13" TextChanged="TextBox_TextChanged" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="" >
<GridViewColumn.CellTemplate>
<DataTemplate>
<Button Content="Für alle übernehmen" Height="22" FontWeight="Bold" FontSize="13" Click="Button_Click" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
<Label Content="Bemerkung" HorizontalAlignment="Left" Margin="0,10,0,0" VerticalAlignment="Top" Height="26" Width="113" Grid.Column="0" Grid.Row="4" Grid.ColumnSpan="2" />
<TextBox Text="{Binding Result.Remark, UpdateSourceTrigger=PropertyChanged}" Margin="10,10,10,7" TextWrapping="Wrap" AcceptsReturn="True" AcceptsTab="True" SpellCheck.IsEnabled="True" SpellCheck.SpellingReform="PreAndPostreform" Grid.Row="4" Grid.Column="1" TextChanged="TextBox_TextChanged"/>
<Button Name="btnPresueOk" Background="LightGreen" Grid.ColumnSpan="2" Content="Bestanden" HorizontalAlignment="Left" Height="35" Margin="10,5,0,0" Grid.Row="6" VerticalAlignment="Top" Width="280" Click="BtnPresueOk_Click" Grid.Column="2"/>
<Button Name="btnPresueFailed" Background="LightPink" Grid.ColumnSpan="2" Content="Nicht Bestanden" HorizontalAlignment="Left" Height="35" Margin="9,5,0,0" Grid.Row="6" VerticalAlignment="Top" Width="281" Click="BtnPresueFailed_Click" Grid.Column="0" />
</Grid>
</Grid>
</UserControl>
@@ -1,168 +0,0 @@
using System;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Threading;
using Xylem.Common.Logic.ProductionOrderCore.TestResults;
using Xylem.Common.Production.ProductionUiCordonel.Event;
using Xylem.Common.Production.ProductionUiCordonel.Model;
namespace Xylem.Common.Production.ProductionUiCordonel.ctls
{
/// <summary>
/// Interaction logic for ctlMultiModePressure.xaml
/// </summary>
public partial class ctlMultiModePressure : UserControl
{
public event EventHandler<StringArgs> OnBarcodeInput;
private PressureMultiModeViewModel ViewModel;
public ctlMultiModePressure()
{
InitializeComponent();
}
public void setViewModel(PressureMultiModeViewModel viewModel)
{
ViewModel = viewModel;
viewModel.MeterDetectedHandler += ViewModel_MeterDetectedHandler;
ViewModel.OnStoreDone += ViewModel_OnStoreDone;
//OnBarcodeInput = "PressureControl_OnBarcodeInput"
//
if (viewModel.ChildName == "PressureHY")
{
ViewModel.StationID = 1;
lblHeadline.Content = "hydraulisch Dichtheitsprüfung";
txtLeakrate.Visibility = Visibility.Hidden;
lblLeakrate.Visibility = Visibility.Hidden;
listViewTestPotins.Visibility = Visibility.Hidden;
}
else
{
ViewModel.StationID = 2;
lblHeadline.Content = "Helium Dichtheitsprüfung";
}
}
private void ViewModel_MeterDetectedHandler(Object sender, EventArgs e)
{
Dispatcher.Invoke(DispatcherPriority.Normal,
new Action(() =>
{
Boolean update = false;
if (sender is null)
{
ViewModel.InputIsEnabled = false;
}
else
{
ViewModel.ReloadData(false);
}
}
));
}
private void BtnPresueOk_Click(Object sender, RoutedEventArgs e)
{
ViewModel.StoreData(true);
}
private void BtnPresueFailed_Click(Object sender, RoutedEventArgs e)
{
ViewModel.StoreData(false);
}
private void ViewModel_OnStoreDone(Object sender, StringArgs e)
{
MessageBox.Show(e.Content);
}
private Int32? BarcodeInputActiveOffset;
private String BarcodeInput = "";
private void TextBox_TextChanged(Object sender, TextChangedEventArgs e)
{
if (sender is TextBox txtSender)
{
var c = e.Changes.First();
if (c.RemovedLength == 0)
{
var input = txtSender.Text.Substring(c.Offset, c.AddedLength);
if (BarcodeInputActiveOffset.HasValue)
{
BarcodeInput = $"{BarcodeInput}{input}";
if (input == Environment.NewLine)
{
var tmpOffset = BarcodeInputActiveOffset.Value;
BarcodeInputActiveOffset = null;
//OnBarcodeInput?.Invoke(null, new StringArgs(BarcodeInput));
txtSender.Text = txtSender.Text.Replace(BarcodeInput, "");
BarcodeInput = "";
txtSender.Focus();
txtSender.CaretIndex = tmpOffset;
}
}
else
{
if (ViewModel != null && ViewModel.BarcodeTrigger.Any(t => t == input))
{
BarcodeInput = txtSender.Text.Substring(c.Offset, c.AddedLength);
BarcodeInputActiveOffset = c.Offset;
}
}
}
}
}
private void Button_Click(Object sender, RoutedEventArgs e)
{
String input = "";
var obj = ((FrameworkElement)sender).DataContext;
if (obj is PressureTestPoints ptp)
{
ViewModel.Result.SetAllTestPoints(ptp.Input);
}
var d = listViewTestPotins.DataContext;
listViewTestPotins.DataContext = null;
listViewTestPotins.DataContext = d;
// var c = e.Changes.First();
// if (c.RemovedLength == 0)
// {
// var input = txtSender.Text.Substring(c.Offset, c.AddedLength);
// if (BarcodeInputActiveOffset.HasValue)
// {
// BarcodeInput = $"{BarcodeInput}{input}";
// if (input == System.Environment.NewLine)
// {
// var tmpOffset = BarcodeInputActiveOffset.Value;
// BarcodeInputActiveOffset = null;
// OnBarcodeInput?.Invoke(null, new StringArgs(BarcodeInput));
// txtSender.Text = txtSender.Text.Replace(BarcodeInput, "");
// BarcodeInput = "";
// txtSender.Focus();
// txtSender.CaretIndex = tmpOffset;
// }
// }
// else
// {
// if (ViewModel != null && ViewModel.BarcodeTrigger.Any(t => t == input))
// {
// BarcodeInput = txtSender.Text.Substring(c.Offset, c.AddedLength);
// BarcodeInputActiveOffset = c.Offset;
// }
// }
// }
//}
}
}
}
+3 -3
View File
@@ -4,11 +4,11 @@
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1" />
</startup>
<appSettings>
<add key="ConnectionString" value="Server=SLASQL01.emea.sensus.net; Database=Testreplikation; User ID=sa; Password=sqlserver;" />
<!--<add key="ConnectionString" value="Server=SLASQL01.emea.sensus.net; Database=Auftrag; User ID=sa; Password=sqlserver;" />-->
<!--<add key="ConnectionString" value="Server=SLASQL01.emea.sensus.net; Database=Testreplikation; User ID=sa; Password=sqlserver;" />-->
<add key="ConnectionString" value="Server=SLASQL01.emea.sensus.net; Database=Auftrag; User ID=sa; Password=sqlserver;" />
<add key="EncryptionKeisUrl" value="http://sla12iis01.emea.sensus.net/LaaProductionWeb/api/eregister/radiokey/byserialno/{0}" />
<add key="SIRTComPorts" value="COM6,COM8" />
<add key="PSNR" value="2016" />
<add key="PSNR" value="2015" />
</appSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@@ -100,7 +100,7 @@
var sirtHub = new SIRTHub();
SIRTLogger.Message += NLogger.Debug;
// SIRTLogger.State += NLogger.Debug;
SIRTLogger.State += NLogger.Debug;
return sirtHub;
}
+1 -1
View File
@@ -2,6 +2,6 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
ShowsNavigationUI="False"
Source="Pages/ManualProgramming.xaml"
Source="Pages/EregisterFinalize.xaml"
Title="PAM 146: Set metrology parameters">
</NavigationWindow>
@@ -13,7 +13,12 @@
internal class AuftragDbContext
{
private static readonly string connectionString = Appsettings.GetSetting("ConnectionString");
private static readonly SqlConnection sqlConnection = SqlConnection.CreateSqlConnection(connectionString, AppHost.NLogger.Error);
private static readonly SqlConnection sqlConnection = SqlConnection.CreateSqlConnection(connectionString, SQLError);
private static void SQLError(string error)
{
}
internal class eRegister
{
@@ -34,6 +39,7 @@
, SemiDebugDatum = @{nameof(state.SemiDebugDatum)}
, GeschlossenDatum = @{nameof(state.GeschlossenDatum)}
, FunkadresseDatum = @{nameof(state.FunkadresseDatum)}
, TempAdresse = @{nameof(state.TempAdresse)}
WHERE Seriennummer = @{nameof(state.Seriennummer)}")
.SetParameter(nameof(state.Fabrikationsnummer), state.Fabrikationsnummer)
.SetParameter(nameof(state.Bemerkung), state.Bemerkung)
@@ -43,6 +49,7 @@
.SetParameter(nameof(state.SemiDebugDatum), state.SemiDebugDatum)
.SetParameter(nameof(state.GeschlossenDatum), state.GeschlossenDatum)
.SetParameter(nameof(state.FunkadresseDatum), state.FunkadresseDatum)
.SetParameter(nameof(state.TempAdresse), state.TempAdresse)
.SetParameter(nameof(state.Seriennummer), state.Seriennummer)
.ExecuteNonQuery();
}
@@ -254,6 +254,9 @@
this.StartEnabled = true;
this.StopEnabled = false;
AuftragDbContext.eRegister.Update(this.eregisterFactory.GetEregisterStates().ToList());
AuftragDbContext.eRegister_History.Save(this.eregisterFactory.GetEregisterHistories().ToList());
try
{
this.cancellationTokenSource?.Cancel();
@@ -265,9 +268,6 @@
this.eregisterFactory.StopProgramming();
}
catch { }
AuftragDbContext.eRegister.Update(this.eregisterFactory.GetEregisterStates());
AuftragDbContext.eRegister_History.Save(this.eregisterFactory.GetEregisterHistories());
}
private void Timer_Elapsed(object _, ElapsedEventArgs args)
@@ -87,7 +87,7 @@
EncryptionKey = encryptionKey,
Data = new ChangeFactoryState
{
Mode = FactoryState.Production
FactoryState = FactoryState.Production
}
.Append(new ProvidePin
{
@@ -471,7 +471,6 @@
<Compile Include="Infrastructure\TempMeterModels.cs" />
<Compile Include="Infrastructure\UserLoginModel.cs" />
<Compile Include="OfflinePasswordItem.cs" />
<Compile Include="ProccessConfig.cs" />
<Compile Include="Program.cs" />
<Compile Include="ProgrammState.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -1,12 +0,0 @@
using System;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig;
namespace Xylem.Common.Ui.GenesisToolBox
{
internal class ProccessConfig : ProcessConfig
{
public ProccessConfig(String file) : base(file)
{
}
}
}
+126 -21
View File
@@ -53,9 +53,6 @@
this.tabPage3 = new System.Windows.Forms.TabPage();
this.cmdAddOffline = new System.Windows.Forms.Button();
this.dgvofflinePw = new System.Windows.Forms.DataGridView();
this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.offlinePaswordItemBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.tabPage4 = new System.Windows.Forms.TabPage();
this.lblGlobalCurrentPath = new System.Windows.Forms.Label();
this.btnGlobalSearch = new System.Windows.Forms.Button();
@@ -70,14 +67,27 @@
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.tabPage5 = new System.Windows.Forms.TabPage();
this.lblSirtStation = new System.Windows.Forms.Label();
this.lblSirtBoxNo = new System.Windows.Forms.Label();
this.lblSirtComport433MHz = new System.Windows.Forms.Label();
this.lblSirtComport868MHz = new System.Windows.Forms.Label();
this.tbxSirtStationId = new System.Windows.Forms.TextBox();
this.tbxSirtBoxNo = new System.Windows.Forms.TextBox();
this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.offlinePaswordItemBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.cbxSirtComport433MHz = new System.Windows.Forms.ComboBox();
this.cbxSirtComport868MHz = new System.Windows.Forms.ComboBox();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvConfig)).BeginInit();
this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvofflinePw)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.offlinePaswordItemBindingSource)).BeginInit();
this.tabPage4.SuspendLayout();
this.tabPage5.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.offlinePaswordItemBindingSource)).BeginInit();
this.SuspendLayout();
//
// btnReload
@@ -106,6 +116,7 @@
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Controls.Add(this.tabPage4);
this.tabControl1.Controls.Add(this.tabPage5);
this.tabControl1.Location = new System.Drawing.Point(12, 74);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
@@ -320,22 +331,6 @@
this.dgvofflinePw.Size = new System.Drawing.Size(345, 170);
this.dgvofflinePw.TabIndex = 16;
//
// dataGridViewTextBoxColumn1
//
this.dataGridViewTextBoxColumn1.DataPropertyName = "PcbID";
this.dataGridViewTextBoxColumn1.HeaderText = "PcbID";
this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
//
// dataGridViewTextBoxColumn2
//
this.dataGridViewTextBoxColumn2.DataPropertyName = "Password";
this.dataGridViewTextBoxColumn2.HeaderText = "Password";
this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
//
// offlinePaswordItemBindingSource
//
this.offlinePaswordItemBindingSource.DataSource = typeof(Xylem.Common.Ui.GenesisToolBox.OfflinePasswordItem);
//
// tabPage4
//
this.tabPage4.Controls.Add(this.lblGlobalCurrentPath);
@@ -481,6 +476,105 @@
this.label2.TabIndex = 0;
this.label2.Text = "Local (only ToolBox)";
//
// tabPage5
//
this.tabPage5.Controls.Add(this.cbxSirtComport868MHz);
this.tabPage5.Controls.Add(this.cbxSirtComport433MHz);
this.tabPage5.Controls.Add(this.tbxSirtBoxNo);
this.tabPage5.Controls.Add(this.tbxSirtStationId);
this.tabPage5.Controls.Add(this.lblSirtComport868MHz);
this.tabPage5.Controls.Add(this.lblSirtComport433MHz);
this.tabPage5.Controls.Add(this.lblSirtBoxNo);
this.tabPage5.Controls.Add(this.lblSirtStation);
this.tabPage5.Location = new System.Drawing.Point(4, 22);
this.tabPage5.Name = "tabPage5";
this.tabPage5.Size = new System.Drawing.Size(760, 361);
this.tabPage5.TabIndex = 4;
this.tabPage5.Text = "SIRT";
this.tabPage5.UseVisualStyleBackColor = true;
//
// lblSirtStation
//
this.lblSirtStation.AutoSize = true;
this.lblSirtStation.Location = new System.Drawing.Point(22, 24);
this.lblSirtStation.Name = "lblSirtStation";
this.lblSirtStation.Size = new System.Drawing.Size(57, 13);
this.lblSirtStation.TabIndex = 2;
this.lblSirtStation.Text = "Station ID:";
//
// lblSirtBoxNo
//
this.lblSirtBoxNo.AutoSize = true;
this.lblSirtBoxNo.Location = new System.Drawing.Point(22, 51);
this.lblSirtBoxNo.Name = "lblSirtBoxNo";
this.lblSirtBoxNo.Size = new System.Drawing.Size(45, 13);
this.lblSirtBoxNo.TabIndex = 3;
this.lblSirtBoxNo.Text = "Box No:";
//
// lblSirtComport433MHz
//
this.lblSirtComport433MHz.AutoSize = true;
this.lblSirtComport433MHz.Location = new System.Drawing.Point(22, 78);
this.lblSirtComport433MHz.Name = "lblSirtComport433MHz";
this.lblSirtComport433MHz.Size = new System.Drawing.Size(95, 13);
this.lblSirtComport433MHz.TabIndex = 4;
this.lblSirtComport433MHz.Text = "Comport 433 MHz:";
//
// lblSirtComport868MHz
//
this.lblSirtComport868MHz.AutoSize = true;
this.lblSirtComport868MHz.Location = new System.Drawing.Point(22, 106);
this.lblSirtComport868MHz.Name = "lblSirtComport868MHz";
this.lblSirtComport868MHz.Size = new System.Drawing.Size(95, 13);
this.lblSirtComport868MHz.TabIndex = 5;
this.lblSirtComport868MHz.Text = "Comport 868 MHz:";
//
// tbxSirtStationId
//
this.tbxSirtStationId.Location = new System.Drawing.Point(142, 17);
this.tbxSirtStationId.Name = "tbxSirtStationId";
this.tbxSirtStationId.Size = new System.Drawing.Size(100, 20);
this.tbxSirtStationId.TabIndex = 6;
//
// tbxSirtBoxNo
//
this.tbxSirtBoxNo.Location = new System.Drawing.Point(142, 44);
this.tbxSirtBoxNo.Name = "tbxSirtBoxNo";
this.tbxSirtBoxNo.Size = new System.Drawing.Size(100, 20);
this.tbxSirtBoxNo.TabIndex = 7;
//
// dataGridViewTextBoxColumn1
//
this.dataGridViewTextBoxColumn1.DataPropertyName = "PcbID";
this.dataGridViewTextBoxColumn1.HeaderText = "PcbID";
this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
//
// dataGridViewTextBoxColumn2
//
this.dataGridViewTextBoxColumn2.DataPropertyName = "Password";
this.dataGridViewTextBoxColumn2.HeaderText = "Password";
this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
//
// offlinePaswordItemBindingSource
//
this.offlinePaswordItemBindingSource.DataSource = typeof(Xylem.Common.Ui.GenesisToolBox.OfflinePasswordItem);
//
// cbxSirtComport433MHz
//
this.cbxSirtComport433MHz.FormattingEnabled = true;
this.cbxSirtComport433MHz.Location = new System.Drawing.Point(142, 75);
this.cbxSirtComport433MHz.Name = "cbxSirtComport433MHz";
this.cbxSirtComport433MHz.Size = new System.Drawing.Size(121, 21);
this.cbxSirtComport433MHz.TabIndex = 8;
//
// cbxSirtComport868MHz
//
this.cbxSirtComport868MHz.FormattingEnabled = true;
this.cbxSirtComport868MHz.Location = new System.Drawing.Point(142, 102);
this.cbxSirtComport868MHz.Name = "cbxSirtComport868MHz";
this.cbxSirtComport868MHz.Size = new System.Drawing.Size(121, 21);
this.cbxSirtComport868MHz.TabIndex = 9;
//
// FrmSetup
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -500,9 +594,11 @@
this.tabPage2.PerformLayout();
this.tabPage3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgvofflinePw)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.offlinePaswordItemBindingSource)).EndInit();
this.tabPage4.ResumeLayout(false);
this.tabPage4.PerformLayout();
this.tabPage5.ResumeLayout(false);
this.tabPage5.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.offlinePaswordItemBindingSource)).EndInit();
this.ResumeLayout(false);
}
@@ -550,5 +646,14 @@
private System.Windows.Forms.Button btnGlobalDefaultLan;
private System.Windows.Forms.Button btnGlobalDefaultLocal;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TabPage tabPage5;
private System.Windows.Forms.Label lblSirtComport868MHz;
private System.Windows.Forms.Label lblSirtComport433MHz;
private System.Windows.Forms.Label lblSirtBoxNo;
private System.Windows.Forms.Label lblSirtStation;
private System.Windows.Forms.TextBox tbxSirtBoxNo;
private System.Windows.Forms.TextBox tbxSirtStationId;
private System.Windows.Forms.ComboBox cbxSirtComport868MHz;
private System.Windows.Forms.ComboBox cbxSirtComport433MHz;
}
}
+51 -9
View File
@@ -39,9 +39,10 @@ namespace Xylem.Common.Ui.GenesisToolBox
private readonly String _serialConfigFilePathName;
private readonly String _offlinePwdPathName;
private readonly DataTable _slotConfigDataTable = new DataTable();
private readonly ProcessConfig _configuration;
//private readonly List<String> _sirt433MhzComports = new List<String>();
//private readonly List<String> _sirt868MHzComports = new List<String>();
private readonly SirtConfig _sirtConfig = new SirtConfig();
private readonly ProcessConfig _configuration = new ProcessConfig();
/// <summary>
/// Ctor
@@ -78,12 +79,33 @@ namespace Xylem.Common.Ui.GenesisToolBox
cbcSlotType.HeaderText = SlotTypeString;
LoadFromFile();
_configuration = new ProcessConfig(ProgramConfig.ConfigFileName);
_configuration.ReadProcessConfig();
cbUseMinMaxCheck.Checked = _configuration.UseMinMaxCheck;
cbUseRegisterWatch.Checked = _configuration.UseRegisterWatchService;
txtWachSeriveUrl.Text = _configuration.RegisterWatchServiceUrl;
cbUpdateFiles.Checked = _configuration.AutoUpdateFiles;
cbxProductionMode.Checked = _configuration.ProductionMode;
_sirtConfig.ReadSirtConfig();
tbxSirtStationId.Text = _sirtConfig.StationId?.ToString();
tbxSirtBoxNo.Text = _sirtConfig.SirtBoxNo?.ToString();
if (_sirtConfig.SirtComport433MHz != null)
cbxSirtComport433MHz.Items.Add(_sirtConfig.SirtComport433MHz);
if (_sirtConfig.SirtComport868MHz != null)
cbxSirtComport868MHz.Items.Add(_sirtConfig.SirtComport868MHz);
var comPorts = SerialPort.GetPortNames().ToList();
foreach (var comPort in comPorts.Where(comPort => !cbxSirtComport433MHz.Items.Contains(comPort)))
{
cbxSirtComport433MHz.Items.Add(comPort);
}
foreach (var comPort in comPorts.Where(comPort => !cbxSirtComport868MHz.Items.Contains(comPort)))
{
cbxSirtComport868MHz.Items.Add(comPort);
}
cbxSirtComport433MHz.Text = cbxSirtComport433MHz.Items[0].ToString();
cbxSirtComport868MHz.Text = cbxSirtComport868MHz.Items[0].ToString();
}
private void BtnReload_Click(Object sender, EventArgs e)
@@ -96,6 +118,25 @@ namespace Xylem.Common.Ui.GenesisToolBox
{
StoreToPc();
StoreOfflineFile();
StoreSirtSettings();
}
private void StoreSirtSettings()
{
// Get the SIRT settings from the GUI
if (int.TryParse(tbxSirtStationId.Text, out var intNo))
{
_sirtConfig.StationId = intNo;
}
if (int.TryParse(tbxSirtBoxNo.Text, out intNo))
{
_sirtConfig.SirtBoxNo = intNo;
}
_sirtConfig.SirtComport433MHz = cbxSirtComport433MHz.Text;
_sirtConfig.SirtComport868MHz = cbxSirtComport868MHz.Text;
_sirtConfig.Update();
}
private void StoreToPc()
@@ -401,28 +442,28 @@ namespace Xylem.Common.Ui.GenesisToolBox
private void cbUseRegisterWatch_CheckedChanged(Object sender, EventArgs e)
{
_configuration.UseRegisterWatchService = cbUseRegisterWatch.Checked;
_configuration.Update(ProgramConfig.ConfigFileName);
_configuration.Update();
StoreToPc();
}
private void cbUseMinMaxCheck_CheckedChanged(Object sender, EventArgs e)
{
_configuration.UseMinMaxCheck = cbUseMinMaxCheck.Checked;
_configuration.Update(ProgramConfig.ConfigFileName);
_configuration.Update();
StoreToPc();
}
private void textBox1_TextChanged(Object sender, EventArgs e)
{
_configuration.RegisterWatchServiceUrl = txtWachSeriveUrl.Text;
_configuration.Update(ProgramConfig.ConfigFileName);
_configuration.Update();
StoreToPc();
}
private void cbUpdateFiles_CheckedChanged(Object sender, EventArgs e)
{
_configuration.AutoUpdateFiles = cbUpdateFiles.Checked;
_configuration.Update(ProgramConfig.ConfigFileName);
_configuration.Update();
StoreToPc();
}
@@ -503,6 +544,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
}
else
{
// ReSharper disable once LocalizableElement
MessageBox.Show("Developer mode! Configuration.json can be exchanged on individual requirements.\n" +
"\nRISK:\n" +
"- Register ranges cannot be checked\n" +
@@ -510,7 +552,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
}
_configuration.ProductionMode = cbxProductionMode.Checked;
_configuration.Update(ProgramConfig.ConfigFileName);
_configuration.Update();
StoreToPc();
}
+24
View File
@@ -138,6 +138,30 @@
<metadata name="btcDetectStreaming.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tbcSlot.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cbcRequestPort.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cbcRequestType.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cbcStreamingPort.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cbcSlotType.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="btcDetectRequest.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="btcDetectStreaming.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="offlinePaswordItemBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="offlinePaswordItemBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>