Initial commit
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
||||
|
||||
<appSettings>
|
||||
<add key="SirtComport433" value="6" />
|
||||
<add key="SirtComport868" value="8" />
|
||||
<add key="SirtBoxNr" value="3" />
|
||||
<add key="StationID" value="1" />
|
||||
|
||||
</appSettings>
|
||||
|
||||
|
||||
|
||||
</configuration>
|
||||
@@ -0,0 +1,9 @@
|
||||
<Application x:Class="ProductionUiCordonel.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:ProductionUiCordonel"
|
||||
Startup="Application_Startup">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace ProductionUiCordonel
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
public App()
|
||||
{
|
||||
//this.StartupUri = new Uri("MainWindow.xaml");
|
||||
//this.StartupUri = new Uri("MultiMode.xaml");
|
||||
}
|
||||
private void Application_Startup(object sender, StartupEventArgs e)
|
||||
{
|
||||
|
||||
if (true)
|
||||
{
|
||||
FinalRadioTest mainWindow = new FinalRadioTest();
|
||||
mainWindow.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
MultiMode otherWindow = new MultiMode();
|
||||
|
||||
otherWindow.Show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace 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 bool Visisble { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int Slot { get; set; }
|
||||
public string TextPort { get; set; }
|
||||
public Pos StartPos { get; set; }
|
||||
|
||||
}
|
||||
public int Slot { get; set; }
|
||||
|
||||
public int? PressureStationId { get; set; }
|
||||
public bool AutoDetect { get; set; }
|
||||
|
||||
public bool AccessToPresuretestTab { get; set; }
|
||||
public bool AccessToMarrieTab { get; set; }
|
||||
public bool AccessToFinalcheckTab { get; set; }
|
||||
|
||||
public bool AccessToSettingTab { get; set; }
|
||||
public bool AccessToStatusTab { get; set; }
|
||||
public bool AccessToPickingTab { get; set; }
|
||||
|
||||
|
||||
public int? SirtComport433 { get; set; }
|
||||
public int? SirtComport866 { get; set; }
|
||||
public int? SirtBoxNr { get; set; }
|
||||
|
||||
public int? 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());
|
||||
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(Xylem.Common.Hardware.WaterMeter.Genesis), file);
|
||||
|
||||
if (!File.Exists(configFile))
|
||||
{
|
||||
configFile = Path.Combine(file);
|
||||
}
|
||||
|
||||
File.WriteAllText(file, JsonConvert.SerializeObject(this));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
//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();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,124 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
||||
|
||||
namespace ProductionUiCordonel.Data
|
||||
{
|
||||
public class PickingItemCheckReturn
|
||||
{
|
||||
public bool? Result;
|
||||
public string Msg;
|
||||
}
|
||||
|
||||
public abstract class PickingResultBaseData : IPickingResultData
|
||||
{
|
||||
public string Ident { get; set; }
|
||||
|
||||
public int Index { get; set; }
|
||||
|
||||
public string CheckText { get; set; }
|
||||
|
||||
public string CurrentValueText { get; set; }
|
||||
|
||||
public bool? Result { get; set; }
|
||||
|
||||
public bool HasError { get; set; }
|
||||
|
||||
public System.Windows.Media.Brush ResultColor { get { return getColorFromResult(); } }
|
||||
public abstract Func<PickingItemCheckReturn> Action { get; }
|
||||
|
||||
private System.Windows.Media.Brush getColorFromResult()
|
||||
{
|
||||
var converter = new System.Windows.Media.BrushConverter();
|
||||
var brush = (System.Windows.Media.Brush)converter.ConvertFromString("#000000");
|
||||
|
||||
if (Result.HasValue) // && a.Result.Value ))
|
||||
{
|
||||
if (!Result.Value)
|
||||
{
|
||||
brush = (System.Windows.Media.Brush)converter.ConvertFromString("#FF8000");
|
||||
}
|
||||
else
|
||||
{
|
||||
brush = (System.Windows.Media.Brush)converter.ConvertFromString("#419C14");
|
||||
}
|
||||
|
||||
}
|
||||
return brush;
|
||||
}
|
||||
|
||||
}
|
||||
public interface IPickingResultData
|
||||
{
|
||||
string Ident { get; set; }
|
||||
|
||||
int Index { get; set; }
|
||||
string CheckText { get; set; }
|
||||
|
||||
string CurrentValueText { get; set; }
|
||||
|
||||
bool? Result { get; set; }
|
||||
|
||||
bool HasError { get; set; }
|
||||
|
||||
System.Windows.Media.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 { get { return 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.ConvertTo<UInt32>(r));
|
||||
retComp.Msg = intNumber.ToString();
|
||||
}
|
||||
else if (CompareObject is Boolean boolCompare)
|
||||
{
|
||||
retComp.Result = boolCompare.Equals(RegisterConverter.ConvertTo<bool>(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 { get { return _action; } }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Xylem.Common.Logic.ProductionOrderCore.TestResults;
|
||||
|
||||
namespace 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 int rev = 0;
|
||||
|
||||
public int Rev
|
||||
{
|
||||
get { return rev; }
|
||||
set
|
||||
{
|
||||
rev = value;
|
||||
InternalPropertyChanged(nameof(Rev));
|
||||
}
|
||||
}
|
||||
private bool? passed = false;
|
||||
public bool? Passed
|
||||
{
|
||||
get { return passed; }
|
||||
set
|
||||
{
|
||||
passed = value;
|
||||
InternalPropertyChanged(nameof(Passed));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private string testerName = "C. Röhl";
|
||||
public String TesterName
|
||||
{
|
||||
get { return testerName; }
|
||||
set
|
||||
{
|
||||
testerName = value;
|
||||
InternalPropertyChanged(nameof(TesterName));
|
||||
}
|
||||
}
|
||||
|
||||
private string testPressure = "6";
|
||||
public String TestPressure
|
||||
{
|
||||
get { return testPressure; }
|
||||
set
|
||||
{
|
||||
testPressure = value;
|
||||
InternalPropertyChanged(nameof(TestPressure));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private string leakRate = " 0,00001";
|
||||
public String LeakRate
|
||||
{
|
||||
get { return leakRate; }
|
||||
set
|
||||
{
|
||||
leakRate = value;
|
||||
InternalPropertyChanged(nameof(LeakRate));
|
||||
}
|
||||
}
|
||||
|
||||
private string remark = "";
|
||||
public String Remark
|
||||
{
|
||||
get { return 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 { return 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProductionUiCordonel.Event
|
||||
{
|
||||
public class StringArgs : EventArgs
|
||||
{
|
||||
public readonly string Content;
|
||||
public StringArgs(string content)
|
||||
{
|
||||
Content = content;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
<Window x:Class="ProductionUiCordonel.FinalRadioTest"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ProductionUiCordonel"
|
||||
xmlns:uc="clr-namespace:ProductionUiCordonel"
|
||||
mc:Ignorable="d"
|
||||
Title="FinalTest" MinHeight="500" MinWidth="400" Height="603" Width="646" Initialized="Window_Initialized" Closing="Window_Closing">
|
||||
<DockPanel HorizontalAlignment="Stretch" Width="634" Height="569" VerticalAlignment="Top" Margin="0,0,2,0">
|
||||
<ToolBarTray DockPanel.Dock="Top" Visibility="Collapsed">
|
||||
<ToolBar>
|
||||
<Label>Slot:</Label>
|
||||
<ComboBox Name="cbxSlotBox" Margin="0,5,0,0" VerticalAlignment="Top" SelectionChanged="CbxSlotBox_SelectionChanged" />
|
||||
|
||||
|
||||
<Button Name="BtnConntect" VerticalAlignment="Top" Click="BtnConntect_Click" HorizontalAlignment="Right" ToolTip="Force connect to meter">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Source="/Resources/Connect_16x.png" />
|
||||
<TextBlock Margin="3,0,0,0">Connect</TextBlock>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
|
||||
</ToolBar>
|
||||
<ToolBar Name="tbarOrder">
|
||||
<Label>Order:</Label>
|
||||
<TextBox Name="txtOrderNr" HorizontalAlignment="Left" Height="26" IsEnabled="False" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="81" />
|
||||
|
||||
</ToolBar>
|
||||
<ToolBar>
|
||||
<Label>Autodetect:</Label>
|
||||
<Button Name="BtnSwitchAutoDetect" VerticalAlignment="Top" Click="BtnSwitchAutoDetect_Click" HorizontalAlignment="Right" >
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Source="/Resources/Refresh_16x.png" />
|
||||
<TextBlock Name="tblkAutodetectState" Text="Off" Margin="3,0,0,0"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</ToolBar>
|
||||
</ToolBarTray>
|
||||
<StatusBar DockPanel.Dock="Bottom">
|
||||
<StatusBar.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="50" />
|
||||
<ColumnDefinition Width="100" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="100" />
|
||||
</Grid.ColumnDefinitions>
|
||||
</Grid>
|
||||
</ItemsPanelTemplate>
|
||||
</StatusBar.ItemsPanel>
|
||||
<StatusBarItem Grid.Column="0">
|
||||
<Label Content="PcbID:"/>
|
||||
</StatusBarItem>
|
||||
<StatusBarItem Grid.Column="1">
|
||||
<Label Name="lblPcbID" Content="-"/>
|
||||
</StatusBarItem>
|
||||
<Separator Grid.Column="2" />
|
||||
<StatusBarItem Grid.Column="3">
|
||||
<TextBlock Name="lblMessage" Text="Init" />
|
||||
</StatusBarItem>
|
||||
<Separator Grid.Column="4" />
|
||||
<StatusBarItem Grid.Column="5">
|
||||
<Label x:Name="lblState" Content="" HorizontalAlignment="Left" Height="Auto" VerticalAlignment="Top" />
|
||||
</StatusBarItem>
|
||||
</StatusBar>
|
||||
|
||||
<Grid Background="AliceBlue" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="238" MinHeight="150"/>
|
||||
<RowDefinition Height="28"/>
|
||||
<RowDefinition Height="28"/>
|
||||
<RowDefinition MinHeight="50"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition MinWidth="125" Width="1*"/>
|
||||
<ColumnDefinition MinWidth="148" Width="1*"/>
|
||||
<ColumnDefinition MinWidth="125" Width="4*" />
|
||||
<ColumnDefinition MinWidth="100" Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Name="btnStart" IsEnabled="False" Content="Start" Click="ButtonBase_OnClick" HorizontalAlignment="Left" Height="58" Margin="236,0,0,2" VerticalAlignment="Bottom" Width="122" Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="2" Grid.RowSpan="2" />
|
||||
<Label Content="SerialNumber" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="0" Grid.Column="0" Height="26" Width="82" />
|
||||
<Label Content="RadioAdress" HorizontalAlignment="Left" Margin="10,2,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="0" Height="26" Width="76" />
|
||||
<Label Content="OrderNumber" HorizontalAlignment="Left" Margin="10,3,0,0" VerticalAlignment="Top" Grid.Row="2" Grid.Column="0" Height="26" Width="84" />
|
||||
|
||||
|
||||
<Label Content="" Name="lblSerialNumber" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="0" Grid.Column="1" Height="26" Width="128" />
|
||||
<Label Content="" Name="lblRadioAdress" HorizontalAlignment="Left" Margin="10,2,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="1" Height="26" Width="128" />
|
||||
<Label Content="" Name="lblOrderNumber" HorizontalAlignment="Left" Margin="10,3,0,0" VerticalAlignment="Top" Grid.Row="2" Grid.Column="1" Height="26" Width="128" />
|
||||
|
||||
<Label Content="Status" HorizontalAlignment="Left" Margin="10,3,0,0" VerticalAlignment="Top" Grid.Row="3" Grid.Column="0" Height="26" Width="84" />
|
||||
<Label Content="Warte auf Zähler" Name="lblCurrentProcess" Margin="10,3,10,0" VerticalAlignment="Top" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3" Height="26" />
|
||||
|
||||
<DataGrid Name="dgTotalProcess" ItemsSource="{Binding}" AutoGenerateColumns="True" HorizontalAlignment="Left" Margin="10,4,0,5" Width="253" Grid.Column="0" Grid.Row="4" Grid.ColumnSpan="2" Grid.RowSpan="2" SelectionMode="Single" IsReadOnly="True" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserResizeRows="False" CanUserSortColumns="False" IsEnabled="False"/>
|
||||
<DockPanel Name="dpSubProcess" Grid.Column="2" Height="218" Margin="10,4,0,0" Grid.Row="4" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Width="332" Grid.ColumnSpan="2"/>
|
||||
|
||||
<TextBox Name="txtLog" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="7" TextWrapping="Wrap" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,73,10" />
|
||||
<ProgressBar Name="pbTotalProgress" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="6" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,73,0" />
|
||||
<ProgressBar Name="pbSubProgress" Grid.ColumnSpan="2" Grid.Column="2" Grid.Row="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,73,0"/>
|
||||
<Button x:Name="btnDetect" IsEnabled="false" Content="Detect" Click="BtnDetect_Click" HorizontalAlignment="Left" Height="58" Margin="109,0,0,1" VerticalAlignment="Bottom" Width="122" Grid.Row="0" Grid.Column="2" Grid.RowSpan="2" />
|
||||
</Grid>
|
||||
|
||||
</DockPanel>
|
||||
</Window>
|
||||
|
||||
@@ -0,0 +1,708 @@
|
||||
using Newtonsoft.Json;
|
||||
using ProductionUiCordonel.ProductionProcesses;
|
||||
using ProductionUiCordonel.ProductionProcesses.Actions;
|
||||
using ProductionUiCordonel.ProductionProcesses.Enum;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Threading;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
using Xylem.Common.CommonCore.Consts;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
|
||||
using Xylem.Common.Logic.SoftwareAccessHelper;
|
||||
|
||||
namespace ProductionUiCordonel
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for FinalRadioTest.xaml
|
||||
/// </summary>
|
||||
public partial class FinalRadioTest : Window
|
||||
{
|
||||
public event EventHandler OnLockMeter;
|
||||
public event EventHandler OnReleaseMeter;
|
||||
public event EventHandler OrderHasChanged;
|
||||
#region prop
|
||||
|
||||
private GenesisMeter genesisMeter;
|
||||
public GenesisMeter CurrentGenesisMeter
|
||||
{
|
||||
get { return genesisMeter; }
|
||||
set
|
||||
{
|
||||
var oldMeter = genesisMeter;
|
||||
genesisMeter = value;
|
||||
meterHasChanged(oldMeter, genesisMeter);
|
||||
}
|
||||
}
|
||||
|
||||
private int orderNumber = 0;
|
||||
public int OrderNumber
|
||||
{
|
||||
////lblOrderNumber
|
||||
get
|
||||
{
|
||||
return orderNumber;
|
||||
}
|
||||
set
|
||||
{
|
||||
orderNumber = value;
|
||||
updateContentControl(lblOrderNumber, "-");
|
||||
if (orderNumber != 0)
|
||||
{
|
||||
updateContentControl(lblOrderNumber, orderNumber.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
private long radioAdress = 0;
|
||||
public long RadioAdress
|
||||
{
|
||||
get
|
||||
{
|
||||
return radioAdress;
|
||||
}
|
||||
set
|
||||
{
|
||||
radioAdress = value;
|
||||
updateContentControl(lblRadioAdress, "-");
|
||||
if (radioAdress != 0)
|
||||
{
|
||||
updateContentControl(lblRadioAdress, radioAdress.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
private string serialNumber = "-";
|
||||
public string SerialNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return serialNumber;
|
||||
}
|
||||
set
|
||||
{
|
||||
serialNumber = value;
|
||||
updateContentControl(lblSerialNumber, "-");
|
||||
if (!String.IsNullOrEmpty(serialNumber))
|
||||
{
|
||||
updateContentControl(lblSerialNumber, serialNumber);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private string lastPcbID;
|
||||
private string currentProcess = "-";
|
||||
public string CurrentProcess
|
||||
{
|
||||
get
|
||||
{
|
||||
return currentProcess;
|
||||
}
|
||||
set
|
||||
{
|
||||
currentProcess = value;
|
||||
updateContentControl(lblCurrentProcess, "-");
|
||||
if (!String.IsNullOrEmpty(currentProcess))
|
||||
{
|
||||
updateContentControl(lblCurrentProcess, currentProcess);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Wait for a Meter to connect
|
||||
#endregion
|
||||
|
||||
|
||||
private MultiProcessController pc = new MultiProcessController();
|
||||
|
||||
public FinalRadioTest()
|
||||
{
|
||||
InitializeComponent();
|
||||
SetUpBlank();
|
||||
|
||||
|
||||
|
||||
}
|
||||
public EventHandler OnPcbIdDetect;
|
||||
|
||||
private int intervalWithoutDetect = 1000;
|
||||
private int intervalWithDetect = 10000;
|
||||
private string _currentPcbID;
|
||||
private Timer tmrAutoDetect;
|
||||
public ApplicationSettings Settings { get; set; }
|
||||
private void Window_Initialized(object sender, EventArgs e)
|
||||
{
|
||||
var configfile = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), nameof(Xylem.Common.Hardware.WaterMeter.Genesis), ProgramConfig.SerialConfigFileName);
|
||||
|
||||
if (!File.Exists(configfile))
|
||||
{
|
||||
throw new ApplicationException($"Configuration file {configfile} not found ");
|
||||
}
|
||||
var tr = new StreamReader(configfile);
|
||||
var meterConfigList = JsonConvert.DeserializeObject<SlotConfig[]>(tr.ReadToEnd());
|
||||
|
||||
cbxSlotBox.Items.Clear();
|
||||
foreach (var item in meterConfigList.OrderBy(s => s.Slot))
|
||||
{
|
||||
cbxSlotBox.Items.Add(item.Slot);
|
||||
}
|
||||
|
||||
cbxSlotBox.SelectedIndex = 0;
|
||||
tmrAutoDetect = new Timer(intervalWithoutDetect);
|
||||
tmrAutoDetect.Elapsed += TmrAutoDetect_Elapsed;
|
||||
tmrAutoDetect.Enabled = false;
|
||||
|
||||
|
||||
Settings = new ApplicationSettings("ProductionUiConfig.json");
|
||||
|
||||
|
||||
useSetting(true);
|
||||
}
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
DisposeAllConnections();
|
||||
}
|
||||
private void useSetting(bool setSlot = false)
|
||||
{
|
||||
tmrAutoDetect.Enabled = Settings.AutoDetect;
|
||||
tblkAutodetectState.Text = "Off";
|
||||
if (Settings.AutoDetect)
|
||||
{
|
||||
tblkAutodetectState.Text = "On";
|
||||
}
|
||||
if (setSlot)
|
||||
{
|
||||
cbxSlotBox.SelectedValue = Settings.Slot;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
private void DisposeAllConnections()
|
||||
{
|
||||
|
||||
if (CurrentBatch != null)
|
||||
{
|
||||
CurrentBatch.RemoveAllMeters();
|
||||
if (CurrentGenesisMeter != null)
|
||||
{
|
||||
CurrentGenesisMeter.Dispose();
|
||||
}
|
||||
CurrentBatch.Dispose();
|
||||
}
|
||||
|
||||
}
|
||||
private MeterBatch CurrentBatch;
|
||||
private bool detectIsLocked;
|
||||
|
||||
|
||||
private string _lastMsg;
|
||||
public string LastMsg
|
||||
{
|
||||
set
|
||||
{
|
||||
_lastMsg = value;
|
||||
updateUi(lblMessage, _lastMsg);
|
||||
}
|
||||
get
|
||||
{
|
||||
return _lastMsg;
|
||||
}
|
||||
}
|
||||
private void updateUi(ContentControl c, string content)
|
||||
{
|
||||
c.Dispatcher.Invoke(DispatcherPriority.Normal,
|
||||
new Action(() => { c.Content = content; }));
|
||||
}
|
||||
private void updateUi(TextBox c, string content)
|
||||
{
|
||||
c.Dispatcher.Invoke(DispatcherPriority.Normal,
|
||||
new Action(() => { c.Text = content; }));
|
||||
}
|
||||
private void updateUi(TextBlock c, string content)
|
||||
{
|
||||
c.Dispatcher.Invoke(DispatcherPriority.Normal,
|
||||
new Action(() => { c.Text = content; }));
|
||||
}
|
||||
public string CurrentPcbID
|
||||
{
|
||||
set
|
||||
{
|
||||
if (_currentPcbID != value && !(string.IsNullOrEmpty(_currentPcbID) && value == null))
|
||||
{
|
||||
|
||||
if (_currentPcbID != value)
|
||||
{
|
||||
|
||||
if (!string.IsNullOrEmpty(_currentPcbID) && string.IsNullOrEmpty(value))
|
||||
{
|
||||
_currentPcbID = value;
|
||||
updateUi(lblPcbID, _currentPcbID);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentPcbID = value;
|
||||
updateUi(lblPcbID, _currentPcbID);
|
||||
|
||||
if (!string.IsNullOrEmpty(_currentPcbID))
|
||||
{
|
||||
GetPcbMapping(_currentPcbID);
|
||||
}
|
||||
}
|
||||
}
|
||||
OnPcbIdDetect?.Invoke(CurrentPcbID, EventArgs.Empty);
|
||||
}
|
||||
|
||||
}
|
||||
get
|
||||
{
|
||||
return _currentPcbID;
|
||||
}
|
||||
}
|
||||
private void GetPcbMapping(string pcbID)
|
||||
{
|
||||
if (string.IsNullOrEmpty(pcbID))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var url = $"{ServiceUrls.MarriageServiceUrl()}GetSerialNumberAndOrderNumber?PcbId={pcbID}&withRadioAdress=true";
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var responseJson = LocalWebRequest.GetRequest(url);
|
||||
var a = JsonConvert.DeserializeObject<string[]>(responseJson);
|
||||
|
||||
|
||||
|
||||
var tmpInt = 0;
|
||||
int.TryParse(a[1], out tmpInt);
|
||||
OrderNumber = tmpInt;
|
||||
long tmpLong = 0;
|
||||
if (a.Length > 2)
|
||||
{
|
||||
long.TryParse(a[2], out tmpLong);
|
||||
|
||||
}
|
||||
|
||||
RadioAdress = tmpLong;
|
||||
SerialNumber = a[0];
|
||||
if (a.Length > 3 && a[3] != SerialNumber)
|
||||
{
|
||||
SerialNumber = $"{SerialNumber} / {a[3]}";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (ex is WebException)
|
||||
{
|
||||
MessageBox.Show($"Error on Store: {Environment.NewLine} { ((WebException)ex).Message}");
|
||||
}
|
||||
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
});
|
||||
}
|
||||
private bool Detect(bool IgnorErrors, int slot)
|
||||
{
|
||||
if (!detectIsLocked)
|
||||
{
|
||||
LastMsg = "Start Detect";
|
||||
CurrentProcess = "Suche Cordonel";
|
||||
bool hasDetect = false;
|
||||
if (string.IsNullOrEmpty(CurrentPcbID) || CurrentGenesisMeter == null)
|
||||
{
|
||||
var mb = new MeterBatch();
|
||||
var tryMeter = new GenesisMeter();
|
||||
try
|
||||
{
|
||||
tryMeter.SetupFromConfigFile(slot);
|
||||
mb.AddMeter(tryMeter);
|
||||
tryMeter.Logout();
|
||||
LastMsg = "Try to get PcbID";
|
||||
CurrentPcbID = tryMeter.GetPcbId();
|
||||
|
||||
hasDetect = !string.IsNullOrEmpty(CurrentPcbID);
|
||||
CurrentBatch = mb;
|
||||
CurrentGenesisMeter = tryMeter;
|
||||
if (hasDetect)
|
||||
{
|
||||
LastMsg = $"New PcbID detected {CurrentPcbID}";
|
||||
CurrentProcess = "Cordonel verbunden";
|
||||
CurrentGenesisMeter.Login();
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentProcess = "Cordonel nicht gefunden";
|
||||
LastMsg = $"No Meter found";
|
||||
DisposeAllConnections();
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (!IgnorErrors)
|
||||
{
|
||||
MessageBox.Show($"Error occur.{ Environment.NewLine} {e.Message}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
LastMsg = "Check if Meter is still connected";
|
||||
var ret = CurrentGenesisMeter.GetPcbId();
|
||||
if (string.IsNullOrEmpty(ret) || ret != CurrentPcbID)
|
||||
{
|
||||
LastMsg = "Meter connection lost";
|
||||
hasDetect = false;
|
||||
DisposeAllConnections();
|
||||
|
||||
CurrentPcbID = "";
|
||||
Detect(IgnorErrors, slot);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
LastMsg = "Meter is still connected";
|
||||
hasDetect = true;
|
||||
}
|
||||
}
|
||||
return hasDetect;
|
||||
}
|
||||
else
|
||||
{
|
||||
LastMsg = "Meter is still connected (locked)";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
private void TmrAutoDetect_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
tmrAutoDetect.Enabled = false;
|
||||
var hasDetect = Detect(true, 1);
|
||||
if (hasDetect)
|
||||
{
|
||||
tmrAutoDetect.Interval = intervalWithDetect;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmrAutoDetect.Interval = intervalWithoutDetect;
|
||||
}
|
||||
tmrAutoDetect.Enabled = Settings.AutoDetect;
|
||||
}
|
||||
|
||||
|
||||
public void SetUpBlank()
|
||||
{
|
||||
|
||||
pc.Processes = new List<IProductionProcess>();
|
||||
pc.ProcessStateChangedHandler += Pc_ProcessStateChangedHandler;
|
||||
pc.ProcessLogHandler += PcOnProcessLogHandler;
|
||||
pc.ProcessProgressHandler += Pc_ProcessProgressHandler;
|
||||
|
||||
var connectProcess = new ProductionProcessConnect();
|
||||
pc.Processes.Add(connectProcess); //[x] [x] [x]
|
||||
|
||||
|
||||
|
||||
var CheckOrder = new ProductionProcessCheckOrderNumber(OrderNumber);
|
||||
CheckOrder.isDone += CheckOrder_isDone;
|
||||
|
||||
pc.Processes.Add(CheckOrder); //[x] [x] [x]
|
||||
pc.Processes.Add(new ProductionProcessCheckSerialNumber(SerialNumber)); //[x] [x] [x]
|
||||
//pc.Processes.Add(new ProductionProcessFullReadOut()); //[x] [x] [x]
|
||||
|
||||
pc.Processes.Add(new ProductionProcessPasswordFile()); //[x] [x] [x]
|
||||
|
||||
|
||||
//pc.Processes.Add(new ProductionProcessFinalParameterizationFix()); //[x] [x] []
|
||||
pc.Processes.Add(new ProductionProcessFinalParameterizationVakoCsd(connectProcess)); //[x] [x] []
|
||||
var radioCheck = new ProductionProcessRadioCheck();
|
||||
CheckOrder.isDone += delegate (object sender, EventArgs e)
|
||||
{
|
||||
radioCheck.Ordernumber = ((ProductionProcessCheckOrderNumber)sender).Ordernumber;
|
||||
};
|
||||
pc.Processes.Add(radioCheck); //[] [] []
|
||||
|
||||
|
||||
//pc.Processes.Add(new ProductionProcessSpecialConfig()); //[x] [x] []
|
||||
pc.Processes.Add(new ProductionProcessShippingMode()); //[] [] []
|
||||
|
||||
pc.Processes.Add(new ProductionProcessFinalParameterizationVakoCsd(connectProcess)); //[x] [x] []
|
||||
pc.Processes.Add(new ProductionProcessShippingMode()); //[] [] []
|
||||
|
||||
pc.Processes.Add(new ProductionProcessFullReadOut()); //[x] [x] [x]
|
||||
pc.Processes.Add(new ProductionProcessLogOff()); //[] [] []
|
||||
|
||||
var checkAttach = new ProductionProcessCheckAttachment(OrderNumber);
|
||||
CheckOrder.isDone += (x, g) =>
|
||||
{
|
||||
checkAttach.OrderNumber = ((ProductionProcessCheckOrderNumber)x).Ordernumber; ;
|
||||
};
|
||||
pc.Processes.Add(checkAttach); //[] [] []
|
||||
|
||||
var errorP = new ProductionProcessDone(true);
|
||||
|
||||
errorP.isDone += allProcessesDone;
|
||||
pc.ErrorProcess = errorP;
|
||||
|
||||
var successeP = new ProductionProcessDone(false);
|
||||
|
||||
successeP.isDone += allProcessesDone;
|
||||
pc.DoneProcess = successeP;
|
||||
|
||||
|
||||
|
||||
updateStatusGrid();
|
||||
UiElmEnable(btnDetect, true);
|
||||
}
|
||||
|
||||
private void CheckOrder_isDone(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
OrderNumber = ((ProductionProcessCheckOrderNumber)sender).Ordernumber;
|
||||
OrderHasChanged?.Invoke(this, e);
|
||||
}
|
||||
|
||||
|
||||
private void Radio_CheckOrder_isDone(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
OrderNumber = ((ProductionProcessCheckOrderNumber)sender).Ordernumber;
|
||||
OrderHasChanged?.Invoke(this, e);
|
||||
}
|
||||
|
||||
private void allProcessesDone(object sender, EventArgs e)
|
||||
{
|
||||
detectIsLocked = false;
|
||||
SetUpBlank();
|
||||
}
|
||||
|
||||
private void meterHasChanged(GenesisMeter oldMeter, GenesisMeter newMeter)
|
||||
{
|
||||
if (newMeter == null && oldMeter == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (newMeter == null && oldMeter != null)
|
||||
{
|
||||
//remove all
|
||||
CurrentProcess = "Warte auf Zähler";
|
||||
UiElmEnable(btnStart, false);
|
||||
UiElmEnable(btnDetect, true);
|
||||
Task.Run(() => { LoadDetails(); });
|
||||
return;
|
||||
}
|
||||
|
||||
if (oldMeter?.PcbId == newMeter?.PcbId && newMeter?.PcbId == lastPcbID)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UiElmEnable(btnStart, true);
|
||||
UiElmEnable(btnDetect, false);
|
||||
CurrentProcess = "Bitte den Startknopf drücken";
|
||||
Task.Run(() => { LoadDetails(); });
|
||||
|
||||
|
||||
|
||||
|
||||
//real change
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void UiElmEnable(UIElement elm, bool isEnabled)
|
||||
{
|
||||
elm.Dispatcher.Invoke(DispatcherPriority.Normal,
|
||||
new Action(() =>
|
||||
{
|
||||
elm.IsEnabled = isEnabled;
|
||||
|
||||
}
|
||||
));
|
||||
}
|
||||
private void PcOnProcessLogHandler(object sender, PopUpProcessLogArgs e)
|
||||
{
|
||||
txtLog.Dispatcher.Invoke(DispatcherPriority.Normal,
|
||||
new Action(() =>
|
||||
{
|
||||
if (e != null)
|
||||
{
|
||||
txtLog.Text = e.Data;
|
||||
}
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
private void Pc_ProcessProgressHandler(Object sender, PopUpProcessProgressArgs e)
|
||||
{
|
||||
if (e.ProgressType == PopUpProcessProgressArgs.ProcessProgessType.Total)
|
||||
{
|
||||
pbTotalProgress.Dispatcher.Invoke(DispatcherPriority.Normal,
|
||||
new Action(() =>
|
||||
{
|
||||
if (e != null)
|
||||
{
|
||||
pbTotalProgress.Value = e.Progress;
|
||||
}
|
||||
}
|
||||
));
|
||||
}
|
||||
else if (e.ProgressType == PopUpProcessProgressArgs.ProcessProgessType.SubProcess)
|
||||
{
|
||||
pbSubProgress.Dispatcher.Invoke(DispatcherPriority.Normal,
|
||||
new Action(() =>
|
||||
{
|
||||
if (e != null)
|
||||
{
|
||||
pbSubProgress.Value = e.Progress;
|
||||
}
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
private void updateContentControl(ContentControl ctl, string text)
|
||||
{
|
||||
ctl.Dispatcher.Invoke(DispatcherPriority.Normal,
|
||||
new Action(() =>
|
||||
{
|
||||
if (ctl != null) // table is a DataTable
|
||||
{
|
||||
ctl.Content = text;
|
||||
}
|
||||
}
|
||||
));
|
||||
}
|
||||
private void updateStatusGrid()
|
||||
{
|
||||
var dt = new DataTable();
|
||||
dt.Columns.Add("Process");
|
||||
dt.Columns.Add("State");
|
||||
var i = 0;
|
||||
foreach (var item in pc.Processes)
|
||||
{
|
||||
dt.Rows.Add();
|
||||
dt.Rows[i][0] = item.GetName();
|
||||
dt.Rows[i][1] = ProductionProcessStateHelper.GetTextFromProductionProcessState(item.GetState());
|
||||
i++;
|
||||
}
|
||||
|
||||
dgTotalProcess.Dispatcher.Invoke(DispatcherPriority.Normal,
|
||||
new Action(() =>
|
||||
{
|
||||
if (dt != null) // table is a DataTable
|
||||
{
|
||||
dgTotalProcess.DataContext = dt;
|
||||
}
|
||||
}
|
||||
));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void updateProcessControl(UserControl c)
|
||||
{
|
||||
dgTotalProcess.Dispatcher.Invoke(DispatcherPriority.Normal,
|
||||
new Action(() =>
|
||||
{
|
||||
dpSubProcess.Children.Clear();
|
||||
dpSubProcess.Children.Add(c);
|
||||
DockPanel.SetDock(c, Dock.Top & Dock.Left & Dock.Right);
|
||||
}
|
||||
));
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void Pc_ProcessStateChangedHandler(object sender, EventArgs e)
|
||||
{
|
||||
if (sender is IProductionProcess)
|
||||
{
|
||||
var currentProcess = ((IProductionProcess)sender);
|
||||
updateProcessControl(currentProcess.GetUserControl());
|
||||
}
|
||||
|
||||
updateStatusGrid();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void ButtonBase_OnClick(Object sender, RoutedEventArgs e)
|
||||
{
|
||||
OnLockMeter?.Invoke(sender, EventArgs.Empty);
|
||||
btnStart.IsEnabled = false;
|
||||
CurrentGenesisMeter.SerialNumber = SerialNumber;
|
||||
CurrentProcess = "gestartet";
|
||||
pc.Start(CurrentGenesisMeter);
|
||||
|
||||
}
|
||||
|
||||
public void LoadDetails()
|
||||
{
|
||||
if (CurrentGenesisMeter == null || string.IsNullOrEmpty(CurrentGenesisMeter.PcbId))
|
||||
{
|
||||
currentProcess = "Warte auf Zähler";
|
||||
OrderNumber = 0;
|
||||
SerialNumber = "-";
|
||||
RadioAdress = 0;
|
||||
return;
|
||||
}
|
||||
lastPcbID = CurrentGenesisMeter.PcbId;
|
||||
currentProcess = "Bitte starten";
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void BtnSwitchAutoDetect_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Settings.AutoDetect = !Settings.AutoDetect;
|
||||
storeSetting();
|
||||
useSetting();
|
||||
}
|
||||
|
||||
private void CbxSlotBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
private void storeSetting()
|
||||
{
|
||||
Settings.Update("ProductionUiConfig.json");
|
||||
}
|
||||
|
||||
private void BtnConntect_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var hasDetect = Detect(false, (int)cbxSlotBox.SelectedValue);
|
||||
|
||||
Settings.Slot = (int)cbxSlotBox.SelectedValue;
|
||||
storeSetting();
|
||||
}
|
||||
|
||||
private void BtnDetect_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var hasDetect = Detect(true,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<Window x:Class="ProductionUiCordonel.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ProductionUiCordonel"
|
||||
xmlns:uc="clr-namespace:ProductionUiCordonel"
|
||||
mc:Ignorable="d"
|
||||
Title="Cordonel Production UI" MinHeight="500" MinWidth="400" Height="600" Width="644" Initialized="Window_Initialized" Closing="Window_Closing">
|
||||
<Window.Resources>
|
||||
<local:QuantityToBackgroundConverter x:Key="BackgroundConverter" />
|
||||
</Window.Resources>
|
||||
<DockPanel HorizontalAlignment="Right" Width="634" Height="569" VerticalAlignment="Top" Margin="0,0,2,0">
|
||||
<ToolBarTray DockPanel.Dock="Top">
|
||||
<ToolBar>
|
||||
<Label>Slot:</Label>
|
||||
<ComboBox Name="cbxSlotBox" Margin="0,5,0,0" VerticalAlignment="Top" SelectionChanged="CbxSlotBox_SelectionChanged" />
|
||||
|
||||
|
||||
<Button Name="BtnConntect" VerticalAlignment="Top" Click="BtnConntect_Click" HorizontalAlignment="Right" ToolTip="Force connect to meter">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Source="/Resources/Connect_16x.png" />
|
||||
<TextBlock Margin="3,0,0,0">Connect</TextBlock>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
|
||||
</ToolBar>
|
||||
<ToolBar Name="tbarOrder">
|
||||
<Label>Order:</Label>
|
||||
<TextBox Name="txtOrderNr" HorizontalAlignment="Left" Height="26" IsEnabled="False" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="81" />
|
||||
|
||||
</ToolBar>
|
||||
<ToolBar>
|
||||
<Label>Autodetect:</Label>
|
||||
<Button Name="BtnSwitchAutoDetect" VerticalAlignment="Top" Click="BtnSwitchAutoDetect_Click" HorizontalAlignment="Right" >
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Source="/Resources/Refresh_16x.png" />
|
||||
<TextBlock Name="tblkAutodetectState" Text="Off" Margin="3,0,0,0"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</ToolBar>
|
||||
</ToolBarTray>
|
||||
<StatusBar DockPanel.Dock="Bottom">
|
||||
<StatusBar.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="50" />
|
||||
<ColumnDefinition Width="100" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="100" />
|
||||
</Grid.ColumnDefinitions>
|
||||
</Grid>
|
||||
</ItemsPanelTemplate>
|
||||
</StatusBar.ItemsPanel>
|
||||
<StatusBarItem Grid.Column="0">
|
||||
<Label Content="PcbID:"/>
|
||||
</StatusBarItem>
|
||||
<StatusBarItem Grid.Column="1">
|
||||
<Label Name="lblPcbID" Content="-"/>
|
||||
</StatusBarItem>
|
||||
<Separator Grid.Column="2" />
|
||||
<StatusBarItem Grid.Column="3">
|
||||
<TextBlock Name="lblMessage" Text="Init" />
|
||||
</StatusBarItem>
|
||||
<Separator Grid.Column="4" />
|
||||
<StatusBarItem Grid.Column="5">
|
||||
<Label x:Name="lblState" Content="" HorizontalAlignment="Left" Height="Auto" VerticalAlignment="Top" />
|
||||
</StatusBarItem>
|
||||
</StatusBar>
|
||||
|
||||
|
||||
<StackPanel Background="#FFE5E5E5" SizeChanged="StackPanel_SizeChanged" Height="506" VerticalAlignment="Top" HorizontalAlignment="Stretch" Width="625" >
|
||||
<uc:FinalRadioTest x:Name="ucFinalRadioTest" Loaded="UcFinalRadioTest_Loaded" Width="Auto" VerticalAlignment="Top" HorizontalAlignment="Stretch" />
|
||||
</StackPanel>
|
||||
|
||||
</DockPanel>
|
||||
</Window>
|
||||
@@ -0,0 +1,483 @@
|
||||
using Newtonsoft.Json;
|
||||
using ProductionUiCordonel.Model;
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Threading;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
using Xylem.Common.CommonCore.Consts;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
|
||||
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
|
||||
using Xylem.Common.Logic.SoftwareAccessHelper;
|
||||
|
||||
namespace ProductionUiCordonel
|
||||
{
|
||||
public class QuantityToBackgroundConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
var dc = DisplayCodes.None;
|
||||
|
||||
if (DisplayCodes.TryParse(value.ToString(), out dc))
|
||||
{
|
||||
string hex = "";
|
||||
int intValue;
|
||||
if (int.TryParse(value.ToString(), out intValue))
|
||||
{
|
||||
hex = intValue.ToString("X");
|
||||
}
|
||||
return $"{dc} ({hex})";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "?";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private Timer tmrAutoDetect;
|
||||
|
||||
public EventHandler OnPcbIdDetect;
|
||||
|
||||
private int intervalWithoutDetect = 1000;
|
||||
private int intervalWithDetect = 10000;
|
||||
private string _currentPcbID;
|
||||
|
||||
|
||||
public PickingViewModel PickingData = new PickingViewModel();
|
||||
|
||||
public string CurrentPcbID
|
||||
{
|
||||
set
|
||||
{
|
||||
if (_currentPcbID != value && !(string.IsNullOrEmpty(_currentPcbID) && value == null))
|
||||
{
|
||||
|
||||
if (_currentPcbID != value)
|
||||
{
|
||||
|
||||
if (!string.IsNullOrEmpty(_currentPcbID) && string.IsNullOrEmpty(value))
|
||||
{
|
||||
_currentPcbID = value;
|
||||
updateUi(lblPcbID, _currentPcbID);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentPcbID = value;
|
||||
updateUi(lblPcbID, _currentPcbID);
|
||||
|
||||
if (!string.IsNullOrEmpty(_currentPcbID))
|
||||
{
|
||||
GetPcbMapping(_currentPcbID);
|
||||
}
|
||||
}
|
||||
}
|
||||
OnPcbIdDetect?.Invoke(CurrentPcbID, EventArgs.Empty);
|
||||
}
|
||||
|
||||
}
|
||||
get
|
||||
{
|
||||
return _currentPcbID;
|
||||
}
|
||||
}
|
||||
|
||||
public enum uiState
|
||||
{
|
||||
not_connected,
|
||||
connected
|
||||
}
|
||||
|
||||
private uiState _currentState;
|
||||
public uiState CurrentState
|
||||
{
|
||||
set
|
||||
{
|
||||
_currentState = value;
|
||||
updateUi(lblState, _currentState.ToString());
|
||||
}
|
||||
get
|
||||
{
|
||||
return _currentState;
|
||||
}
|
||||
}
|
||||
|
||||
private string _lastMsg;
|
||||
public string LastMsg
|
||||
{
|
||||
set
|
||||
{
|
||||
_lastMsg = value;
|
||||
updateUi(lblMessage, _lastMsg);
|
||||
}
|
||||
get
|
||||
{
|
||||
return _lastMsg;
|
||||
}
|
||||
}
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (true)
|
||||
{
|
||||
|
||||
}
|
||||
InitializeComponent();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace);
|
||||
}
|
||||
|
||||
}
|
||||
public ApplicationSettings Settings { get; set; }
|
||||
private void Window_Initialized(object sender, EventArgs e)
|
||||
{
|
||||
var configfile = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), nameof(Xylem.Common.Hardware.WaterMeter.Genesis), ProgramConfig.SerialConfigFileName);
|
||||
|
||||
if (!File.Exists(configfile))
|
||||
{
|
||||
throw new ApplicationException($"Configuration file {configfile} not found ");
|
||||
}
|
||||
var tr = new StreamReader(configfile);
|
||||
var meterConfigList = JsonConvert.DeserializeObject<SlotConfig[]>(tr.ReadToEnd());
|
||||
|
||||
cbxSlotBox.Items.Clear();
|
||||
foreach (var item in meterConfigList.OrderBy(s => s.Slot))
|
||||
{
|
||||
cbxSlotBox.Items.Add(item.Slot);
|
||||
}
|
||||
|
||||
cbxSlotBox.SelectedIndex = 0;
|
||||
tmrAutoDetect = new Timer(intervalWithoutDetect);
|
||||
tmrAutoDetect.Elapsed += TmrAutoDetect_Elapsed;
|
||||
tmrAutoDetect.Enabled = false;
|
||||
|
||||
|
||||
Settings = new ApplicationSettings("ProductionUiConfig.json");
|
||||
|
||||
|
||||
useSetting(true);
|
||||
}
|
||||
|
||||
private void TmrAutoDetect_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
tmrAutoDetect.Enabled = false;
|
||||
var hasDetect = Detect(true, 1);
|
||||
if (hasDetect)
|
||||
{
|
||||
tmrAutoDetect.Interval = intervalWithDetect;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmrAutoDetect.Interval = intervalWithoutDetect;
|
||||
}
|
||||
tmrAutoDetect.Enabled = Settings.AutoDetect;
|
||||
}
|
||||
|
||||
|
||||
private void BtnConntect_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var hasDetect = Detect(false, (int)cbxSlotBox.SelectedValue);
|
||||
|
||||
Settings.Slot = (int)cbxSlotBox.SelectedValue;
|
||||
storeSetting();
|
||||
}
|
||||
|
||||
private void updateUi(ContentControl c, string content)
|
||||
{
|
||||
c.Dispatcher.Invoke(DispatcherPriority.Normal,
|
||||
new Action(() => { c.Content = content; }));
|
||||
}
|
||||
private void updateUi(TextBox c, string content)
|
||||
{
|
||||
c.Dispatcher.Invoke(DispatcherPriority.Normal,
|
||||
new Action(() => { c.Text = content; }));
|
||||
}
|
||||
private void updateUi(TextBlock c, string content)
|
||||
{
|
||||
c.Dispatcher.Invoke(DispatcherPriority.Normal,
|
||||
new Action(() => { c.Text = content; }));
|
||||
}
|
||||
|
||||
private MeterBatch CurrentBatch;
|
||||
private GenesisMeter _currentMeter;
|
||||
private bool detectIsLocked;
|
||||
|
||||
private GenesisMeter CurrentMeter
|
||||
{
|
||||
get { return _currentMeter; }
|
||||
set
|
||||
{
|
||||
_currentMeter = value;
|
||||
if (ucFinalRadioTest != null)
|
||||
{
|
||||
if (_currentMeter?.PcbId != null)
|
||||
{
|
||||
ucFinalRadioTest.CurrentGenesisMeter = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
ucFinalRadioTest.CurrentGenesisMeter = null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool Detect(bool IgnorErrors, int slot)
|
||||
{
|
||||
if (!detectIsLocked)
|
||||
{
|
||||
LastMsg = "Start Detect";
|
||||
bool hasDetect = false;
|
||||
if (string.IsNullOrEmpty(CurrentPcbID) || CurrentMeter == null)
|
||||
{
|
||||
var mb = new MeterBatch();
|
||||
var tryMeter = new GenesisMeter();
|
||||
try
|
||||
{
|
||||
tryMeter.SetupFromConfigFile(slot);
|
||||
mb.AddMeter(tryMeter);
|
||||
tryMeter.Logout();
|
||||
LastMsg = "Try to get PcbID";
|
||||
CurrentPcbID = tryMeter.GetPcbId();
|
||||
|
||||
hasDetect = !string.IsNullOrEmpty(CurrentPcbID);
|
||||
CurrentBatch = mb;
|
||||
CurrentMeter = tryMeter;
|
||||
if (hasDetect)
|
||||
{
|
||||
LastMsg = $"New PcbID detected {CurrentPcbID}";
|
||||
|
||||
CurrentMeter.Login();
|
||||
}
|
||||
else
|
||||
{
|
||||
LastMsg = $"No Meter found";
|
||||
DisposeAllConnections();
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (!IgnorErrors)
|
||||
{
|
||||
MessageBox.Show($"Error occur.{ Environment.NewLine} {e.Message}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
LastMsg = "Check if Meter is still connected";
|
||||
var ret = CurrentMeter.GetPcbId();
|
||||
if (string.IsNullOrEmpty(ret) || ret != CurrentPcbID)
|
||||
{
|
||||
LastMsg = "Meter connection lost";
|
||||
hasDetect = false;
|
||||
DisposeAllConnections();
|
||||
|
||||
CurrentPcbID = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
LastMsg = "Meter is still connected";
|
||||
hasDetect = true;
|
||||
}
|
||||
}
|
||||
return hasDetect;
|
||||
}
|
||||
else
|
||||
{
|
||||
LastMsg = "Meter is still connected (locked)";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
DisposeAllConnections();
|
||||
}
|
||||
|
||||
private void DisposeAllConnections()
|
||||
{
|
||||
|
||||
if (CurrentBatch != null)
|
||||
{
|
||||
CurrentBatch.RemoveAllMeters();
|
||||
if (CurrentMeter != null)
|
||||
{
|
||||
CurrentMeter.Dispose();
|
||||
}
|
||||
CurrentBatch.Dispose();
|
||||
}
|
||||
PickingData.Empty();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void GetPcbMapping(string pcbID)
|
||||
{
|
||||
if (string.IsNullOrEmpty(pcbID))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var url = $"{ServiceUrls.MarriageServiceUrl()}GetSerialNumberAndOrderNumber?PcbId={pcbID}&withRadioAdress=true";
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var responseJson = LocalWebRequest.GetRequest(url);
|
||||
var a = JsonConvert.DeserializeObject<string[]>(responseJson);
|
||||
|
||||
|
||||
if (ucFinalRadioTest != null)
|
||||
{
|
||||
var tmpInt = 0;
|
||||
int.TryParse(a[1], out tmpInt);
|
||||
ucFinalRadioTest.OrderNumber = tmpInt;
|
||||
|
||||
tmpInt = 0;
|
||||
if (a.Length > 2)
|
||||
{
|
||||
int.TryParse(a[2], out tmpInt);
|
||||
|
||||
}
|
||||
|
||||
ucFinalRadioTest.RadioAdress = tmpInt;
|
||||
ucFinalRadioTest.SerialNumber = a[0];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (ex is WebException)
|
||||
{
|
||||
MessageBox.Show($"Error on Store: {Environment.NewLine} { ((WebException)ex).Message}");
|
||||
}
|
||||
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void UcFinalRadioTest_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ucFinalRadioTest.OnLockMeter += UcFinalRadioTest_OnLockMeter;
|
||||
ucFinalRadioTest.OnReleaseMeter += UcFinalRadioTest_OnReleaseMeter;
|
||||
}
|
||||
|
||||
private void UcFinalRadioTest_OnLockMeter(object sender, EventArgs e)
|
||||
{
|
||||
detectIsLocked = true;
|
||||
|
||||
}
|
||||
|
||||
private void UcFinalRadioTest_OnReleaseMeter(object sender, EventArgs e)
|
||||
{
|
||||
detectIsLocked = false;
|
||||
ucFinalRadioTest.SetUpBlank();
|
||||
}
|
||||
|
||||
|
||||
private void BtnSwitchAutoDetect_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Settings.AutoDetect = !Settings.AutoDetect;
|
||||
storeSetting();
|
||||
useSetting();
|
||||
}
|
||||
|
||||
private void CbxSlotBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
private void storeSetting()
|
||||
{
|
||||
Settings.Update("ProductionUiConfig.json");
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void useSetting(bool setSlot = false)
|
||||
{
|
||||
tmrAutoDetect.Enabled = Settings.AutoDetect;
|
||||
tblkAutodetectState.Text = "Off";
|
||||
if (Settings.AutoDetect)
|
||||
{
|
||||
tblkAutodetectState.Text = "On";
|
||||
}
|
||||
if (setSlot)
|
||||
{
|
||||
cbxSlotBox.SelectedValue = Settings.Slot;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ucFinalRadioTest.OrderHasChanged += delegate (Object sender, EventArgs args)
|
||||
{
|
||||
txtOrderNr.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => { txtOrderNr.Text = ucFinalRadioTest.OrderNumber.ToString(); }));
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void StackPanel_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
ucFinalRadioTest.Height = e.NewSize.Height;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace ProductionUiCordonel.Model
|
||||
{
|
||||
public interface IMultiModeChildViewModel : INotifyPropertyChanged, IDisposable
|
||||
{
|
||||
string GetChildIdent();
|
||||
|
||||
void InputText(string text);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
|
||||
using Xylem.Common.Logic.ProductionOrderCore;
|
||||
using Xylem.Common.Logic.SoftwareAccessHelper;
|
||||
|
||||
namespace ProductionUiCordonel.Model
|
||||
{
|
||||
public class MarriageMultiModeViewModel : BaseMultiModeChildViewModel
|
||||
{
|
||||
private bool canMarry = false;
|
||||
public bool CanMarry
|
||||
{
|
||||
get { return canMarry; }
|
||||
set
|
||||
{
|
||||
canMarry = value;
|
||||
NotifyPropertyChanged(nameof(CanMarry));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private int serialNr;
|
||||
public int SerialNr
|
||||
{
|
||||
get { return serialNr; }
|
||||
set
|
||||
{
|
||||
serialNr = value;
|
||||
NotifyPropertyChanged(nameof(SerialNr));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool locked = false;
|
||||
public MarriageMultiModeViewModel(string ctrName, int slotNR, List<string> barcodeTrigger, int? stationID = null) : base(ctrName, slotNR, barcodeTrigger, stationID)
|
||||
{
|
||||
base.VisibilityMarriage = System.Windows.Visibility.Visible;
|
||||
base.MeterDetectedHandler += PickingMultiModeViewModel_MeterDetectedHandler;
|
||||
}
|
||||
|
||||
internal async Task<bool> Store()
|
||||
{
|
||||
var url = $"{ServiceUrls.MarriageServiceUrl()}SetPcbToSerial?PcbId={CurrentPcbID}&SerialNumber={SerialNr}&returnMetroData=0";
|
||||
|
||||
return await Task<bool>.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<ProgrammingParameters>>(resp);
|
||||
// foreach (var item in myJsonResponse)
|
||||
// {
|
||||
// CurrentMeter.WriteRegister(item.RegisterName, item.RegisterValue);
|
||||
// }
|
||||
//}
|
||||
CurrentMeter.SetProcessState(DisplayCodes.Mounted);
|
||||
CurrentMeter.GetLastProcessState();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
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 bool SlotIsLocked()
|
||||
{
|
||||
return locked;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,355 @@
|
||||
using NLog;
|
||||
using ProductionUiCordonel.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Timers;
|
||||
using System.Windows;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
|
||||
using Xylem.Common.Utils.Logging;
|
||||
|
||||
namespace ProductionUiCordonel
|
||||
{
|
||||
public abstract class BaseMultiModeChildViewModel : IMultiModeChildViewModel
|
||||
{
|
||||
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private Timer tmrAutoDetect;
|
||||
|
||||
public EventHandler OnPcbIdDetect;
|
||||
public List<string> BarcodeTrigger = new List<string>();
|
||||
|
||||
private int intervalWithoutDetect = 1000;
|
||||
private int intervalWithDetect = 10000;
|
||||
private string _currentPcbID;
|
||||
private MeterBatch Batch = new MeterBatch();
|
||||
private Visibility visibilityMarriage = Visibility.Collapsed;
|
||||
public Visibility VisibilityMarriage
|
||||
{
|
||||
get
|
||||
{
|
||||
return visibilityMarriage;
|
||||
}
|
||||
set
|
||||
{
|
||||
visibilityMarriage = value;
|
||||
|
||||
NotifyPropertyChanged(nameof(VisibilityMarriage));
|
||||
}
|
||||
}
|
||||
|
||||
private Visibility visibilityPicking = Visibility.Collapsed;
|
||||
public Visibility VisibilityPicking
|
||||
{
|
||||
get
|
||||
{
|
||||
return visibilityPicking;
|
||||
}
|
||||
set
|
||||
{
|
||||
visibilityPicking = value;
|
||||
|
||||
NotifyPropertyChanged(nameof(VisibilityPicking));
|
||||
}
|
||||
}
|
||||
|
||||
private Visibility visibilityPressure = Visibility.Collapsed;
|
||||
public Visibility VisibilityPressure
|
||||
{
|
||||
get
|
||||
{
|
||||
return visibilityPressure;
|
||||
}
|
||||
set
|
||||
{
|
||||
visibilityPressure = value;
|
||||
|
||||
NotifyPropertyChanged(nameof(VisibilityPressure));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string currentSlotStateText = "none";
|
||||
public string CurrentSlotStateText
|
||||
{
|
||||
get
|
||||
{
|
||||
return currentSlotStateText;
|
||||
}
|
||||
set
|
||||
{
|
||||
currentSlotStateText = value;
|
||||
|
||||
NotifyPropertyChanged(nameof(CurrentSlotStateText));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private SlotState currentSlotState = SlotState.None;
|
||||
public SlotState CurrentSlotState
|
||||
{
|
||||
get
|
||||
{
|
||||
return 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;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
NotifyPropertyChanged(nameof(CurrentSlotState));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private string slotInfo = "-";
|
||||
public String SlotInfo
|
||||
{
|
||||
get { return slotInfo; }
|
||||
set
|
||||
{
|
||||
slotInfo = value;
|
||||
NotifyPropertyChanged(nameof(SlotInfo));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public enum SlotState
|
||||
{
|
||||
None,
|
||||
IsDetecting,
|
||||
Detected,
|
||||
InProgress,
|
||||
Done,
|
||||
ConnectionLost,
|
||||
Error,
|
||||
Fatal
|
||||
}
|
||||
private string childName = "asd";
|
||||
public String ChildName
|
||||
{
|
||||
get { return childName; }
|
||||
set
|
||||
{
|
||||
childName = value;
|
||||
NotifyPropertyChanged(nameof(ChildName));
|
||||
}
|
||||
}
|
||||
|
||||
private string order;
|
||||
public String Order
|
||||
{
|
||||
get { return order; }
|
||||
set
|
||||
{
|
||||
order = value;
|
||||
NotifyPropertyChanged(nameof(Order));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string CurrentPcbID
|
||||
{
|
||||
get
|
||||
{
|
||||
return _currentPcbID;
|
||||
}
|
||||
set
|
||||
{
|
||||
_currentPcbID = value;
|
||||
|
||||
NotifyPropertyChanged(nameof(CurrentPcbID));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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 int SlotNr;
|
||||
public BaseMultiModeChildViewModel(string ctrName, int slotNR,List<string> barcodeTrigger, int? StationId = null, bool 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 bool SlotIsLocked();
|
||||
|
||||
public event EventHandler MeterDetectedHandler;
|
||||
private bool Detect(int slot)
|
||||
{
|
||||
if (!SlotIsLocked())
|
||||
{
|
||||
Log("Start Detect");
|
||||
bool 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;
|
||||
}
|
||||
else
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,534 @@
|
||||
using Logic.ProductionToProductMapper.Cordonel;
|
||||
using Newtonsoft.Json;
|
||||
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 Xylem.Common.CommonCore.Configuration;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
||||
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
|
||||
using Xylem.Common.Logic.ProductionOrderCore.OrderData;
|
||||
using Xylem.Common.Logic.SoftwareAccessHelper;
|
||||
|
||||
namespace ProductionUiCordonel.Model
|
||||
{
|
||||
internal class MultiModeMasterViewModel : INotifyPropertyChanged
|
||||
{
|
||||
private string pickingState = "Warte auf Scanner";
|
||||
private string pickingScanner = "keine Verbindung";
|
||||
private string pickingSlot = "-";
|
||||
private string pickingResult = "-";
|
||||
|
||||
private System.Windows.Media.Brush pickingResultColor;
|
||||
public System.Windows.Media.Brush PickingResultColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return pickingResultColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
pickingResultColor = value;
|
||||
NotifyPropertyChanged(nameof(PickingResultColor));
|
||||
}
|
||||
}
|
||||
public string PickingState
|
||||
{
|
||||
get
|
||||
{
|
||||
return pickingState;
|
||||
}
|
||||
set
|
||||
{
|
||||
pickingState = value;
|
||||
NotifyPropertyChanged(nameof(PickingState));
|
||||
}
|
||||
}
|
||||
public string PickingScanner
|
||||
{
|
||||
get
|
||||
{
|
||||
return pickingScanner;
|
||||
}
|
||||
set
|
||||
{
|
||||
pickingScanner = value;
|
||||
NotifyPropertyChanged(nameof(PickingScanner));
|
||||
}
|
||||
}
|
||||
public string PickingSlot
|
||||
{
|
||||
get
|
||||
{
|
||||
return pickingSlot;
|
||||
}
|
||||
set
|
||||
{
|
||||
pickingSlot = value;
|
||||
NotifyPropertyChanged(nameof(PickingSlot));
|
||||
}
|
||||
}
|
||||
public string PickingResult
|
||||
{
|
||||
get
|
||||
{
|
||||
return pickingResult;
|
||||
}
|
||||
set
|
||||
{
|
||||
pickingResult = value;
|
||||
NotifyPropertyChanged(nameof(PickingResult));
|
||||
}
|
||||
}
|
||||
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 bool isRuning = false;
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
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 bool Compare(Dictionary<UInt32, UInt32> checkAppsIdVersion, uint Frequency, uint MeterSize, bool PressurePresent)
|
||||
{
|
||||
using (var Batch = new MeterBatch())
|
||||
{
|
||||
|
||||
using (var meter = new GenesisMeter())
|
||||
{
|
||||
|
||||
meter.SetupFromConfigFile(PickingSlotNr);
|
||||
Batch.AddMeter(meter);
|
||||
PickingState = "Am Zähler anmelden";
|
||||
if ((bool)meter.Login())
|
||||
{
|
||||
meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingStarted);
|
||||
var ret = RunCheck(checkAppsIdVersion, Frequency, MeterSize, PressurePresent, meter);
|
||||
|
||||
if (ret)
|
||||
{
|
||||
meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.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(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingFailed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool RunCheck(Dictionary<uint, uint> checkAppsIdVersion, uint Frequency, uint MeterSize, bool PressurePresent, GenesisMeter meter)
|
||||
{
|
||||
PickingState = $"Üperprüfe Parameter";
|
||||
var FrequencyReadOut = RegisterConverter.ConvertTo<UInt32>(meter.ReadRegister("SENSUSRADIO_FrequencyIndicator"));
|
||||
if (FrequencyReadOut != Frequency)
|
||||
{
|
||||
PickingState = $"Falsche Frequenz! soll {Frequency}MHz ist {FrequencyReadOut}MHz";
|
||||
return false;
|
||||
}
|
||||
|
||||
var MeterSizeReadOut = RegisterConverter.ConvertTo<UInt32>(meter.ReadRegister("GENESISFLOW_MeterSize"));
|
||||
if (MeterSizeReadOut != MeterSize)
|
||||
{
|
||||
PickingState = $"Meter Dn falsch! soll {MeterSize}DN ist {MeterSizeReadOut}DN";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
var PressureReadOut = RegisterConverter.ConvertTo<bool>(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 int 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 System.Windows.Media.BrushConverter();
|
||||
if (Compare(PickingOrderDetails.CheckAppsIdVersion, PickingOrderDetails.FrequencyIndicator, PickingOrderDetails.MeterSize, PickingOrderDetails.PressurePresent))
|
||||
{
|
||||
//erfolg anzeigen und weiter
|
||||
var b = (System.Windows.Media.Brush)converter.ConvertFromString("#419C14");
|
||||
b.Freeze();
|
||||
PickingResultColor = b;
|
||||
sm = PickingStateMachine.MeterDone;
|
||||
}
|
||||
else
|
||||
{
|
||||
sm = PickingStateMachine.MeterError;
|
||||
|
||||
var b = (System.Windows.Media.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;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Thread.Sleep(1000);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void Log(string v)
|
||||
{
|
||||
//throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,420 @@
|
||||
using Logic.ProductionToProductMapper.Cordonel;
|
||||
using Newtonsoft.Json;
|
||||
using ProductionUiCordonel.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||
using Xylem.Common.Logic.ProductionOrderCore.OrderData;
|
||||
using Xylem.Common.Logic.SoftwareAccessHelper;
|
||||
|
||||
namespace ProductionUiCordonel.Model
|
||||
{
|
||||
public class PickingMultiModeViewModel : BaseMultiModeChildViewModel
|
||||
{
|
||||
|
||||
private bool inputIsEnabled = false;
|
||||
public bool InputIsEnabled
|
||||
{
|
||||
get { return inputIsEnabled; }
|
||||
set
|
||||
{
|
||||
inputIsEnabled = value;
|
||||
NotifyPropertyChanged(nameof(InputIsEnabled));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private bool locked = false;
|
||||
public PickingMultiModeViewModel(string ctrName, int slotNR, List<string> barcodeTrigger, int? stationID = null) : base(ctrName, slotNR, barcodeTrigger, stationID,false)
|
||||
{
|
||||
VisibilityPicking = Visibility.Visible;
|
||||
base.MeterDetectedHandler += PickingMultiModeViewModel_MeterDetectedHandler;
|
||||
}
|
||||
|
||||
private void PickingMultiModeViewModel_MeterDetectedHandler(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override bool SlotIsLocked()
|
||||
{
|
||||
return locked;
|
||||
}
|
||||
public override void InputText(string text)
|
||||
{
|
||||
Order = text;
|
||||
ReloadData(false);
|
||||
TextForceUpdate();
|
||||
}
|
||||
internal void ReloadData(bool reset)
|
||||
{
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
var orderNR = 0;
|
||||
if (!locked && !string.IsNullOrEmpty(Order) && Order.Length > 6 && int.TryParse(Order, out 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 Ordernumber", 0, 0);
|
||||
locked = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var retCode = 0;
|
||||
str = LocalWebRequest.GetRequestWithError($"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetOrderDetails?ProductionOrderNumber={orderNR}&CheckPcbId={CurrentMeter.PcbId}",out retCode, 15000);
|
||||
|
||||
if (retCode == 417)
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show("NO radio parameter found");
|
||||
}
|
||||
|
||||
if (OrderOverView.Count == OrderOverView.AssignedPicking)
|
||||
{
|
||||
|
||||
UpdatePickingUi("Order is already completed", StatusColor, "Input a new Ordernumber", 0, 0);
|
||||
locked = false;
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
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<uint, uint>();
|
||||
a.Add(0, 486);
|
||||
a.Add(15, 287);
|
||||
if (OrderDteails.FrequencyIndicator == 868)
|
||||
{
|
||||
a.Add(24, 1067);
|
||||
}
|
||||
else
|
||||
{
|
||||
a.Add(24, 1066);
|
||||
}
|
||||
|
||||
Init(CurrentMeter, a, OrderDteails.FrequencyIndicator, OrderDteails.MeterSize, OrderDteails.PressurePresent);
|
||||
|
||||
|
||||
var r = Run(CurrentMeter.PcbId, orderNR.ToString());
|
||||
|
||||
if (r)
|
||||
{
|
||||
doneCount = doneCount + 1;
|
||||
}
|
||||
locked = false;
|
||||
UpdatePickingUi("Start checking meter", StatusColor, orderNR.ToString(), OrderOverView.Count, doneCount);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log(ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
locked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
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, System.Windows.Media.Brush StateColor, string order, int toDo, int 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 event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
private GenesisMeter currentMeter;
|
||||
private PickingCompareItem baseFile;
|
||||
|
||||
public ObservableCollection<IPickingResultData> Data { get; set; }
|
||||
|
||||
private OverallStatus status = OverallStatus.NoDetect;
|
||||
private OverallStatus Status
|
||||
{
|
||||
get { return 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 System.Windows.Media.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 int ToDo { get; private set; }
|
||||
public int Done { get; private set; }
|
||||
|
||||
public void Init(GenesisMeter meter, Dictionary<UInt32, UInt32> checkAppsIdVersion, uint Frequency, uint MeterSize, bool PressurePresent)
|
||||
{
|
||||
|
||||
|
||||
currentMeter = meter;
|
||||
var data = new List<IPickingResultData>();
|
||||
|
||||
data.Add(new PickingResultCustomCheckData(delegate ()
|
||||
{
|
||||
|
||||
var r = meter.Login();
|
||||
meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingStarted);
|
||||
return new PickingItemCheckReturn() { Result = true, Msg = "done" };
|
||||
|
||||
})
|
||||
{ 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 == 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 bool 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(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.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;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
currentMeter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingFailed);
|
||||
if (tmpData.All(a => a.HasError))
|
||||
{
|
||||
Status = OverallStatus.CheckingIsHasError;
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = OverallStatus.CheckingIsNoMatch;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
internal void Empty()
|
||||
{
|
||||
Status = OverallStatus.NoDetect;
|
||||
ChangeDataData(new List<IPickingResultData>());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
using Logic.ProductionToProductMapper.Cordonel;
|
||||
using ProductionUiCordonel.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows.Media;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||
using Xylem.Common.Logic.SoftwareAccessHelper;
|
||||
|
||||
namespace 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; }
|
||||
|
||||
public PickingViewModel()
|
||||
{
|
||||
|
||||
}
|
||||
private OverallStatus status = OverallStatus.NoDetect;
|
||||
private OverallStatus Status
|
||||
{
|
||||
get { return 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 System.Windows.Media.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, uint Frequency, uint MeterSize, bool PressurePresent)
|
||||
{
|
||||
|
||||
|
||||
currentMeter = meter;
|
||||
var data = new List<IPickingResultData>();
|
||||
|
||||
data.Add(new PickingResultCustomCheckData(delegate ()
|
||||
{
|
||||
|
||||
var r = meter.Login();
|
||||
meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingStarted);
|
||||
return new PickingItemCheckReturn() { Result = true, Msg = "done" };
|
||||
|
||||
})
|
||||
{ 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 bool 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(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.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;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
currentMeter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PickingFailed);
|
||||
if (tmpData.All(a => a.HasError))
|
||||
{
|
||||
Status = OverallStatus.CheckingIsHasError;
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = OverallStatus.CheckingIsNoMatch;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
internal void Empty()
|
||||
{
|
||||
Status = OverallStatus.NoDetect;
|
||||
ChangeDataData(new List<IPickingResultData>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
using Newtonsoft.Json;
|
||||
using ProductionUiCordonel.Data;
|
||||
using ProductionUiCordonel.Event;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
using Xylem.Common.Logic.ProductionOrderCore.ProcessState;
|
||||
using Xylem.Common.Logic.ProductionOrderCore.TestResults;
|
||||
using Xylem.Common.Logic.SoftwareAccessHelper;
|
||||
|
||||
namespace ProductionUiCordonel.Model
|
||||
{
|
||||
public class PressureMultiModeViewModel : BaseMultiModeChildViewModel
|
||||
{
|
||||
|
||||
|
||||
public event EventHandler<StringArgs> OnStoreDone;
|
||||
private PressureResultDataNotifyable result = new PressureResultDataNotifyable();
|
||||
public PressureResultDataNotifyable Result
|
||||
{
|
||||
get { return result; }
|
||||
set
|
||||
{
|
||||
result = value;
|
||||
NotifyPropertyChanged(nameof(Result));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool inputIsEnabled = false;
|
||||
public bool InputIsEnabled
|
||||
{
|
||||
get { return inputIsEnabled; }
|
||||
set
|
||||
{
|
||||
inputIsEnabled = value;
|
||||
NotifyPropertyChanged(nameof(InputIsEnabled));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool Locked { get; set; } = false;
|
||||
public int? StationID { get; set; } = null;
|
||||
|
||||
public PressureMultiModeViewModel(string ctrName, int slotNR, List<string> barcodeTrigger, int? stationID = null) : base(ctrName, slotNR, barcodeTrigger, stationID)
|
||||
{
|
||||
base.VisibilityPressure = System.Windows.Visibility.Visible;
|
||||
StationID = stationID;
|
||||
}
|
||||
|
||||
public bool isHydraulicStaion()
|
||||
{
|
||||
|
||||
if (!StationID.HasValue || StationID.Value == 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public override bool SlotIsLocked()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
internal void ReloadData(bool reset)
|
||||
{
|
||||
|
||||
if (Result != null && Result.PcbId != CurrentPcbID)
|
||||
{
|
||||
InputIsEnabled = false;
|
||||
if (true)
|
||||
{
|
||||
|
||||
}
|
||||
Result = new PressureResultDataNotifyable() { Remark = "loading", Testpoints = new ObservableCollection<PressureTestPoints>(), PcbId = "" };
|
||||
Task<PressureResultDataNotifyable>.Run(() =>
|
||||
{
|
||||
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(bool successfull)
|
||||
{
|
||||
|
||||
if (Result != null && Result.PcbId == CurrentPcbID)
|
||||
{
|
||||
InputIsEnabled = false;
|
||||
var isStored = false;
|
||||
var status = Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PressureTestedFailed;
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
var url = ServiceUrls.MeterProcessStateUrl();
|
||||
|
||||
if (successfull)
|
||||
{
|
||||
status = Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.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 = Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PressureTestedFailed;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CurrentMeter.Login();
|
||||
CurrentMeter.SetProcessState(status);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log(ex.Message);
|
||||
status = Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.PressureTestedFailed;
|
||||
OnStoreDone?.Invoke(null, new StringArgs("Can not store Result"));
|
||||
}
|
||||
|
||||
|
||||
if (status == Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.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"));
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
<Window x:Class="ProductionUiCordonel.MultiMode"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ProductionUiCordonel"
|
||||
mc:Ignorable="d"
|
||||
Title="MultiMode" Height="322.026" Width="660.69" Loaded="Window_Loaded" Closed="Window_Closed">
|
||||
<Grid Margin="0,0,28,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="238" MinHeight="150"/>
|
||||
<RowDefinition Height="28"/>
|
||||
<RowDefinition Height="28"/>
|
||||
<RowDefinition MinHeight="50"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="125"/>
|
||||
<ColumnDefinition Width="125"/>
|
||||
<ColumnDefinition Width="125"/>
|
||||
<ColumnDefinition Width="125"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Background="{Binding PickingResultColor}" Content="Kommissionierung" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="0" Grid.Column="0" Height="26" Width="115" />
|
||||
|
||||
<Label Background="{Binding PickingResultColor}" Content="Scanner:" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="0" Height="26" Width="115" />
|
||||
|
||||
<Label Background="{Binding PickingResultColor}" Content="{Binding PickingScanner, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="1" Height="26" Width="115" />
|
||||
<Label Background="{Binding PickingResultColor}" Content="Ep:" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="2" Height="26" Width="115" />
|
||||
|
||||
<Label Background="{Binding PickingResultColor}" Content="{Binding PickingSlot, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="3" Height="26" Width="115" />
|
||||
|
||||
<Label Background="{Binding PickingResultColor}" Content="Medlung:" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="2" Grid.Column="0" Height="26" Width="115" />
|
||||
|
||||
<Label Background="{Binding PickingResultColor}" Content="{Binding PickingState, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Margin="36,1,0,0" VerticalAlignment="Top" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Height="26" Width="332" />
|
||||
|
||||
<Label Background="{Binding PickingResultColor}" Content="Ergebnis:" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="3" Grid.Column="0" Height="26" Width="115" />
|
||||
|
||||
<Label Background="{Binding PickingResultColor}" Content="{Binding PickingResult, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3" Height="26" Width="359" />
|
||||
|
||||
|
||||
|
||||
<!--<Label Content="Dichtigkeit" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="0" Height="26" Width="105" />
|
||||
<Label Content="{Binding PressureHe.Sate}" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="1" Height="26" Width="105" />
|
||||
|
||||
<Label Content="Druck" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="2" Grid.Column="0" Height="26" Width="105" />
|
||||
<Label Content="{Binding PressureSate}" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="2" Grid.Column="1" Height="26" Width="105" />
|
||||
|
||||
<Label Content="Verknüpfung" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="3" Grid.Column="0" Height="26" Width="105" />
|
||||
<Label Content="{Binding MarrySate}" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="3" Grid.Column="1" Height="26" Width="105" />-->
|
||||
|
||||
|
||||
|
||||
|
||||
<!--<Grid Grid.Row="1" Grid.Column="0" Grid.RowSpan="4">
|
||||
<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>
|
||||
</Window>
|
||||
@@ -0,0 +1,209 @@
|
||||
using ProductionUiCordonel.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
|
||||
namespace ProductionUiCordonel
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für MultiMode.xaml
|
||||
/// </summary>
|
||||
public partial class MultiMode : Window
|
||||
{
|
||||
//#region Raw Input API
|
||||
|
||||
//[DllImport("User32.dll")]
|
||||
//extern static uint GetRawInputDeviceList(IntPtr pRawInputDeviceList, ref uint uiNumDevices, uint cbSize);
|
||||
|
||||
//[DllImport("User32.dll")]
|
||||
//extern static uint GetRawInputDeviceInfo(IntPtr hDevice, uint uiCommand, IntPtr pData, ref uint pcbSize);
|
||||
|
||||
//[DllImport("User32.dll")]
|
||||
//extern static bool RegisterRawInputDevices(RAWINPUTDEVICE[] pRawInputDevice, uint uiNumDevices, uint cbSize);
|
||||
|
||||
//[DllImport("User32.dll")]
|
||||
//extern static uint GetRawInputData(IntPtr hRawInput, uint uiCommand, IntPtr pData, ref uint pcbSize, uint cbSizeHeader);
|
||||
|
||||
//#endregion
|
||||
|
||||
MultiModeMasterViewModel multiModeMasterViewModel = new MultiModeMasterViewModel();
|
||||
|
||||
private List<MultiModeChild> Childs = new List<MultiModeChild>();
|
||||
|
||||
public ApplicationSettings AppSettings { get; private set; }
|
||||
//class RawInputDevice : InputDevice
|
||||
//{
|
||||
// public override IInputElement Target => throw new NotImplementedException();
|
||||
|
||||
// public override PresentationSource ActiveSource => throw new NotImplementedException();
|
||||
//}
|
||||
public MultiMode()
|
||||
{
|
||||
|
||||
DataContext = multiModeMasterViewModel;
|
||||
|
||||
InitializeComponent();
|
||||
this.Topmost = false;
|
||||
}
|
||||
private void keyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
public void SetBaseFocus()
|
||||
{
|
||||
//foreach (var item in Childs)
|
||||
//{
|
||||
// item.Key.Activate();
|
||||
//}
|
||||
//this.Activate();
|
||||
//txtBarcodeInput.Focus();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private MultiModeChild addChild(IMultiModeChildViewModel model)
|
||||
{
|
||||
var a = new MultiModeChild(model);
|
||||
|
||||
a.Show();
|
||||
return a;
|
||||
}
|
||||
CancellationTokenSource cts;
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
cts = new CancellationTokenSource();
|
||||
AppSettings = new ApplicationSettings("MultiProductionUiConfig.json");
|
||||
multiModeMasterViewModel.StartPicking(cts);
|
||||
//var trigger = new List<string>();
|
||||
|
||||
//if (AppSettings.ChildForms == null || !AppSettings.ChildForms.Any())
|
||||
//{
|
||||
// AppSettings.ChildForms = new List<ApplicationSettings.MultiFormChilds>();
|
||||
|
||||
// AppSettings.ChildForms.Add(new ApplicationSettings.MultiFormChilds() { Name = "Picking", Slot = 1, ViewModelType = typeof(PickingMultiModeViewModel), StartPos = null, Visisble = true, TextPort = "COM11" });
|
||||
// AppSettings.ChildForms.Add(new ApplicationSettings.MultiFormChilds() { Name = "PressureHE", Slot = 3, ViewModelType = typeof(PressureMultiModeViewModel), StartPos = null, Visisble = true, TextPort = null });
|
||||
// AppSettings.ChildForms.Add(new ApplicationSettings.MultiFormChilds() { Name = "PressureHY", Slot = 1, ViewModelType = typeof(PressureMultiModeViewModel), StartPos = null, Visisble = true, TextPort = null });
|
||||
// AppSettings.ChildForms.Add(new ApplicationSettings.MultiFormChilds() { Name = "Marriage", Slot = 4, ViewModelType = typeof(MarriageMultiModeViewModel), StartPos = null, Visisble = true, TextPort = "COM1" });
|
||||
// AppSettings.Update("MultiProductionUiConfig.json");
|
||||
//}
|
||||
|
||||
|
||||
////AppSettings.ChildForms.ForEach(c => trigger.Add(c.TextPort.ToString()));
|
||||
|
||||
//cts = new CancellationTokenSource();
|
||||
|
||||
//foreach (var item in AppSettings.ChildForms)
|
||||
//{
|
||||
// if (item.Visisble)
|
||||
// {
|
||||
|
||||
|
||||
// IMultiModeChildViewModel mdl = null;
|
||||
// if (item.ViewModelType == typeof(PickingMultiModeViewModel))
|
||||
// {
|
||||
// mdl = new PickingMultiModeViewModel(item.Name, item.Slot, trigger, AppSettings.StationId);
|
||||
// }
|
||||
// else if (item.ViewModelType == typeof(PressureMultiModeViewModel))
|
||||
// {
|
||||
// mdl = new PressureMultiModeViewModel(item.Name, item.Slot, trigger, AppSettings.StationId);
|
||||
// }
|
||||
// else if (item.ViewModelType == typeof(MarriageMultiModeViewModel))
|
||||
// {
|
||||
// mdl = new MarriageMultiModeViewModel(item.Name, item.Slot, trigger, AppSettings.StationId);
|
||||
// }
|
||||
// if (mdl == null)
|
||||
// {
|
||||
// throw new ApplicationException("Bad configuration or old software");
|
||||
// }
|
||||
// var child = addChild(mdl);
|
||||
|
||||
// child.StartTextInputListener(item.TextPort, cts.Token);
|
||||
|
||||
// if (item.StartPos != null)
|
||||
// {
|
||||
// child.WindowStartupLocation = WindowStartupLocation.Manual;
|
||||
// child.Top = item.StartPos.Top;
|
||||
// child.Left = item.StartPos.Left;
|
||||
// child.Height = item.StartPos.Height;
|
||||
// child.Width = item.StartPos.Width;
|
||||
// child.UseDefaultPos = false;
|
||||
// }
|
||||
// child.PosChanged += delegate (object val, EventArgs a)
|
||||
// {
|
||||
// if (val is MultiModeChild mmc)
|
||||
// {
|
||||
// if (mmc.ViewModel is BaseMultiModeChildViewModel baseChild)
|
||||
// {
|
||||
// var aasd = AppSettings.ChildForms.FirstOrDefault(c => c.Name == baseChild.ChildName);
|
||||
// aasd.StartPos = new ApplicationSettings.Pos() { Height = mmc.Height, Left = mmc.Left, Top = mmc.Top, Width = mmc.Width };
|
||||
|
||||
// AppSettings.Update("MultiProductionUiConfig.json");
|
||||
// }
|
||||
// }
|
||||
|
||||
// };
|
||||
|
||||
|
||||
// child.Show();
|
||||
|
||||
// Childs.Add(child);
|
||||
|
||||
// }
|
||||
|
||||
//}
|
||||
|
||||
|
||||
|
||||
//SetBaseFocus();
|
||||
}
|
||||
|
||||
private void delegeChild_PosChange(object sender, EventArgs e)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private void TxtBarcodeInput_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
|
||||
{
|
||||
//if (sender is TextBox text)
|
||||
//{
|
||||
// if (text.Text.ToLower().Contains("clear"))
|
||||
// {
|
||||
// text.Text = string.Empty;
|
||||
// }
|
||||
// else if (text.Text.Contains(System.Environment.NewLine))
|
||||
// {
|
||||
// foreach (var dispatchChild in Childs.Where(x => x.Value == text.Text[0]))
|
||||
// {
|
||||
// dispatchChild.Key.InputText(text.Text.Substring(1, text.Text.Length - 1).Trim());
|
||||
// }
|
||||
|
||||
// text.Text = "";
|
||||
// SetBaseFocus();
|
||||
// }
|
||||
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
private void Window_Closed(object sender, System.EventArgs e)
|
||||
{
|
||||
|
||||
cts.Cancel();
|
||||
|
||||
|
||||
foreach (var item in Childs)
|
||||
{
|
||||
item.Dispose();
|
||||
|
||||
item.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
<Window
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ProductionUiCordonel"
|
||||
xmlns:ctls="clr-namespace:ProductionUiCordonel.ctls" x:Class="ProductionUiCordonel.MultiModeChild"
|
||||
mc:Ignorable="d"
|
||||
|
||||
Title="MultiModeChild" Height="802.824" Width="704.975" WindowStartupLocation="Manual">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="20"/>
|
||||
<RowDefinition Height="20"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Label Content="Name"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0,0,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Grid.Row="0"/>
|
||||
|
||||
<Label Background="LightGray" FontSize="17pt"
|
||||
HorizontalContentAlignment="Right" Margin="10,5,10,0"
|
||||
VerticalAlignment="Top" Height="40"
|
||||
Content="{Binding ChildName}"
|
||||
Grid.Row="1" />
|
||||
<Label Content="Order"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0,0,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Grid.Row="2"/>
|
||||
|
||||
<Label Background="LightGray" FontSize="17pt"
|
||||
HorizontalContentAlignment="Right" Margin="10,10,10,0"
|
||||
VerticalAlignment="Top" Height="40"
|
||||
Content="{Binding Order, UpdateSourceTrigger=PropertyChanged}"
|
||||
Grid.Row="3" />
|
||||
|
||||
<Label Content="SlotInfo"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0,0,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Grid.Row="4"/>
|
||||
|
||||
<Label Background="LightGray" FontSize="17pt"
|
||||
HorizontalContentAlignment="Right" Margin="10,10,10,0"
|
||||
VerticalAlignment="Top" Height="40"
|
||||
Content="{Binding SlotInfo, UpdateSourceTrigger=PropertyChanged}"
|
||||
Grid.Row="5"/>
|
||||
|
||||
<Label Content="State"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0,0,0,0"
|
||||
VerticalAlignment="Top"
|
||||
Grid.Row="6"/>
|
||||
|
||||
<Label Background="LightGray" FontSize="17pt"
|
||||
HorizontalContentAlignment="Right" Margin="10,10,10,0"
|
||||
VerticalAlignment="Top" Height="40"
|
||||
Content="{Binding CurrentSlotStateText, UpdateSourceTrigger=PropertyChanged}"
|
||||
Grid.Row="7"/>
|
||||
|
||||
<ctls:ctlMultiModePressure x:Name="PressureControl" Visibility="{Binding VisibilityPressure}" Grid.Row="8" Margin="0,0,0,0" OnBarcodeInput="PressureControl_OnBarcodeInput" />
|
||||
<ctls:ctlMultiModePicking x:Name="PickingControl" Visibility="{Binding VisibilityPicking}" Grid.Row="8" Margin="0,0,0,0" />
|
||||
<ctls:ctlMultiModeMarriage x:Name="MarriageControl" Visibility="{Binding VisibilityMarriage}" Grid.Row="8" Margin="0,0,0,0"/>
|
||||
|
||||
<Button Content="POS" Grid.Row="9" Click="Button_Click" />
|
||||
<Button Content="Store" Grid.Row="10" Click="Button_Click_1" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,137 @@
|
||||
using ProductionUiCordonel.Model;
|
||||
using System;
|
||||
using System.IO.Ports;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace ProductionUiCordonel
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für MultiModeChild.xaml
|
||||
/// </summary>
|
||||
public partial class MultiModeChild : Window, IDisposable
|
||||
{
|
||||
public IMultiModeChildViewModel ViewModel;
|
||||
|
||||
public bool UseDefaultPos { get; internal set; } = true;
|
||||
public event EventHandler PosChanged;
|
||||
|
||||
|
||||
public MultiModeChild(IMultiModeChildViewModel viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
ViewModel = viewModel;
|
||||
this.DataContext = ViewModel;
|
||||
if (ViewModel is PressureMultiModeViewModel pressureModel)
|
||||
{
|
||||
PressureControl.setViewModel(pressureModel);
|
||||
|
||||
this.Left = 0;
|
||||
this.Top = 250;
|
||||
this.Height = SystemParameters.PrimaryScreenHeight - 300;
|
||||
this.Width = SystemParameters.PrimaryScreenWidth / 2;
|
||||
}
|
||||
if (ViewModel is PickingMultiModeViewModel pickingModel)
|
||||
{
|
||||
PickingControl.setViewModel(pickingModel);
|
||||
|
||||
this.Left = SystemParameters.VirtualScreenLeft;
|
||||
this.Top = SystemParameters.VirtualScreenTop;
|
||||
this.Height = SystemParameters.VirtualScreenHeight;
|
||||
this.Width = SystemParameters.VirtualScreenWidth - SystemParameters.PrimaryScreenWidth;
|
||||
}
|
||||
if (ViewModel is MarriageMultiModeViewModel marriageModel)
|
||||
{
|
||||
MarriageControl.setViewModel(marriageModel);
|
||||
|
||||
this.Left = SystemParameters.PrimaryScreenWidth / 2;
|
||||
this.Top = 250;
|
||||
this.Height = SystemParameters.PrimaryScreenHeight - 300;
|
||||
this.Width = SystemParameters.PrimaryScreenWidth / 2;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
internal void StartTextInputListener(string port, CancellationToken cancellation)
|
||||
{
|
||||
if (port == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var task = new Task(() =>
|
||||
{
|
||||
var a = new SerialPort(port);
|
||||
a.Open();
|
||||
a.NewLine = "\r";
|
||||
while (true)
|
||||
{
|
||||
if (cancellation.IsCancellationRequested)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var resText = a.ReadLine();
|
||||
this.Dispatcher.Invoke(DispatcherPriority.Normal,
|
||||
new Action(() =>
|
||||
{
|
||||
ViewModel.InputText(resText);
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}, cancellation);
|
||||
task.Start();
|
||||
|
||||
|
||||
}
|
||||
|
||||
internal void InputText(string text)
|
||||
{
|
||||
ViewModel.InputText(text);
|
||||
}
|
||||
|
||||
private void BtnPresueFailed_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void TxtPresurePcbId_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void PressureControl_OnBarcodeInput(object sender, Event.StringArgs e)
|
||||
{
|
||||
InputText(e.Content);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
ViewModel.Dispose();
|
||||
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is Button btn)
|
||||
{
|
||||
btn.Content = $"POS L{this.Left},T{this.Top },H{this.Height},W{this.Width}";
|
||||
}
|
||||
}
|
||||
|
||||
private void Button_Click_1(object sender, RoutedEventArgs e)
|
||||
{
|
||||
PosChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
using ProductionUiCordonel.ProductionProcesses.Enum;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using ProductionUiCordonel.UserControls.FinalTest;
|
||||
using System.Threading;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
||||
using Xylem.Common.Logic.SoftwareAccessHelper;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
using Xylem.Common.Logic.ProductionOrderCore.Vako;
|
||||
|
||||
namespace ProductionUiCordonel.ProductionProcesses.Actions
|
||||
{
|
||||
public class ProductionProcessCheckAttachment : BaseProductionProcess
|
||||
{
|
||||
public event EventHandler isDone;
|
||||
private UcDialog UserControl;
|
||||
public DialogResult Result = DialogResult.Error;
|
||||
public enum DialogResult
|
||||
{
|
||||
Error,
|
||||
Acknowledge
|
||||
}
|
||||
public bool DialogIsDone { get; private set; }
|
||||
public int OrderNumber { get; set; }
|
||||
public ProductionProcessCheckAttachment(int orderNumber)
|
||||
{
|
||||
OrderNumber = orderNumber;
|
||||
DialogIsDone = false;
|
||||
name = "Zubehör/Beigaben überprüfen";
|
||||
currentProcessState = ProductionProcessState.Waiting;
|
||||
}
|
||||
public override void InitUserControl()
|
||||
{
|
||||
UserControl = new UcDialog();
|
||||
}
|
||||
|
||||
public override UserControl GetControl()
|
||||
{
|
||||
if (UserControl == null)
|
||||
{
|
||||
throw new Exception($"UserControl {this.GetType()} not Ready");
|
||||
}
|
||||
return UserControl;
|
||||
}
|
||||
|
||||
|
||||
public override void ProcessDone()
|
||||
{
|
||||
//clear
|
||||
}
|
||||
|
||||
private void StepDone()
|
||||
{
|
||||
base.currentProcessState = ProductionProcessState.Done;
|
||||
isDone?.Invoke(null, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void StepError()
|
||||
{
|
||||
base.currentProcessState = ProductionProcessState.Error;
|
||||
isDone?.Invoke(null, EventArgs.Empty);
|
||||
}
|
||||
|
||||
|
||||
public override async void StartProcess()
|
||||
{
|
||||
|
||||
var a = LocalWebRequest.GetRequest($"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetSingleVakoKey?ProductionOrderNumber={OrderNumber}&KeyName=C_GEN_PULS");
|
||||
var myJsonResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<VakoKeyValue>(a);
|
||||
if (myJsonResponse.Value.ToLower() == "q" || myJsonResponse.Value.ToLower() == "k")
|
||||
{
|
||||
UserControl.SetDesc("Pulse Module anbauen!");
|
||||
}
|
||||
else
|
||||
{
|
||||
StepDone();
|
||||
}
|
||||
|
||||
|
||||
|
||||
var OptionList = new List<UcDialog.DialogOption>();
|
||||
var retry = new UcDialog.DialogOption("Nicht möglich", "", () =>
|
||||
{
|
||||
Result = DialogResult.Error;
|
||||
StepError();
|
||||
|
||||
});
|
||||
|
||||
|
||||
OptionList.Add(retry);
|
||||
|
||||
var Acknowledge = new UcDialog.DialogOption("Erledigt", "", () =>
|
||||
{
|
||||
Result = DialogResult.Acknowledge;
|
||||
StepDone();
|
||||
|
||||
});
|
||||
|
||||
|
||||
OptionList.Add(Acknowledge);
|
||||
|
||||
|
||||
UserControl.SetDialogOptions(OptionList);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
using ProductionUiCordonel.ProductionProcesses.Enum;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using ProductionUiCordonel.UserControls.FinalTest;
|
||||
using System.Threading;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using Newtonsoft.Json;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
|
||||
namespace ProductionUiCordonel.ProductionProcesses.Actions
|
||||
{
|
||||
public class ProductionProcessCheckOrderNumber : BaseProductionProcess
|
||||
{
|
||||
public event EventHandler isDone;
|
||||
private UcBarcodeInput UserControl;
|
||||
public DialogResult Result = DialogResult.None;
|
||||
public enum DialogResult
|
||||
{
|
||||
None,
|
||||
Retry,
|
||||
Print,
|
||||
Abort
|
||||
}
|
||||
public bool DialogIsDone { get; private set; }
|
||||
public int SerialNumber { get; private set; }
|
||||
public int Ordernumber { get; private set; }
|
||||
|
||||
private int? OldOrderNumber { get; set; }
|
||||
|
||||
private bool Error = false;
|
||||
public ProductionProcessCheckOrderNumber(int? oldOrderNumber = null)
|
||||
|
||||
{
|
||||
OldOrderNumber = oldOrderNumber;
|
||||
|
||||
DialogIsDone = false;
|
||||
name = "Überprüfe Auftrag";
|
||||
currentProcessState = ProductionProcessState.Waiting;
|
||||
}
|
||||
public override void InitUserControl()
|
||||
{
|
||||
UserControl = new UcBarcodeInput();
|
||||
}
|
||||
|
||||
public override UserControl GetControl()
|
||||
{
|
||||
if (UserControl == null)
|
||||
{
|
||||
throw new Exception($"UserControl {this.GetType()} not Ready");
|
||||
}
|
||||
return UserControl;
|
||||
}
|
||||
|
||||
|
||||
public override void ProcessDone()
|
||||
{
|
||||
//clear
|
||||
}
|
||||
|
||||
private void StepDone()
|
||||
{
|
||||
base.currentProcessState = ProductionProcessState.Done;
|
||||
isDone?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void StepMismatch(string msg)
|
||||
{
|
||||
|
||||
UserControl.SetDesc(msg);
|
||||
UserControl.SetFocusMe();
|
||||
//UserControl.Focus();
|
||||
UserControl.BarcodeInput += UserControl_KeyDown;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void UserControl_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
|
||||
{
|
||||
var a = UserControl.txtHiddenInput.Text;
|
||||
|
||||
UserControl.txtHiddenInput.Text = "";
|
||||
if (OldOrderNumber.HasValue && a == Ordernumber.ToString())
|
||||
{
|
||||
StepDone();
|
||||
}
|
||||
else
|
||||
{
|
||||
StepMismatch($"Falscher oder fehlender Auftrag!{Environment.NewLine}Dieser Zähler ({SerialNumber}) ist teil des Auftrags {Ordernumber}.{Environment.NewLine}Bitte den Auftrag scannen.");
|
||||
|
||||
}
|
||||
|
||||
|
||||
//StepDone();
|
||||
}
|
||||
|
||||
public override async void StartProcess()
|
||||
{
|
||||
|
||||
//get order number
|
||||
GetPcbMapping(Meter.PcbId);
|
||||
|
||||
if (OldOrderNumber.HasValue && OldOrderNumber.Value == Ordernumber)
|
||||
{
|
||||
StepDone();
|
||||
}
|
||||
|
||||
StepMismatch($"Falscher oder fehlender Auftrag!{Environment.NewLine}Dieser Zähler ({SerialNumber}) ist teil des Auftrags {Ordernumber}.{Environment.NewLine}Bitte den Auftrag scannen.");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void GetPcbMapping(string pcbID)
|
||||
{
|
||||
if (string.IsNullOrEmpty(pcbID))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var url = $"{ServiceUrls.MarriageServiceUrl()}GetSerialNumberAndOrderNumber?PcbId={pcbID}";
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
var http = (HttpWebRequest)WebRequest.Create(url);
|
||||
HttpWebResponse response = null;
|
||||
try
|
||||
{
|
||||
response = (HttpWebResponse)http.GetResponse();
|
||||
}
|
||||
catch (WebException exception)
|
||||
{
|
||||
response = (HttpWebResponse)exception.Response;
|
||||
}
|
||||
|
||||
if (response != null && response.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
var responseStream = response.GetResponseStream();
|
||||
using (var sr = new StreamReader(responseStream))
|
||||
{
|
||||
var responseJson = sr.ReadToEnd();
|
||||
var a = JsonConvert.DeserializeObject<string[]>(responseJson);
|
||||
SerialNumber = Convert.ToInt32(a[0]);
|
||||
Ordernumber = Convert.ToInt32(a[1]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (ex is WebException)
|
||||
{
|
||||
//MessageBox.Show($"Error on Store: {Environment.NewLine} { ((WebException)ex).Message}");
|
||||
}
|
||||
|
||||
//MessageBox.Show(ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
using ProductionUiCordonel.ProductionProcesses.Enum;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using ProductionUiCordonel.UserControls.FinalTest;
|
||||
using System.Threading;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using Newtonsoft.Json;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
|
||||
namespace ProductionUiCordonel.ProductionProcesses.Actions
|
||||
{
|
||||
public class ProductionProcessCheckSerialNumber : BaseProductionProcess
|
||||
{
|
||||
public event EventHandler isDone;
|
||||
private UcBarcodeInput UserControl;
|
||||
public DialogResult Result = DialogResult.None;
|
||||
public enum DialogResult
|
||||
{
|
||||
None,
|
||||
Retry,
|
||||
Print,
|
||||
Abort
|
||||
}
|
||||
public bool DialogIsDone { get; private set; }
|
||||
public string PcbSerialNumber { get; private set; }
|
||||
|
||||
private bool Error = false;
|
||||
public ProductionProcessCheckSerialNumber(String pcbSerialNumber)
|
||||
|
||||
{
|
||||
PcbSerialNumber = pcbSerialNumber;
|
||||
|
||||
DialogIsDone = false;
|
||||
name = "Überprüfe Seriennummer/Deckel";
|
||||
currentProcessState = ProductionProcessState.Waiting;
|
||||
}
|
||||
public override void InitUserControl()
|
||||
{
|
||||
UserControl = new UcBarcodeInput();
|
||||
}
|
||||
|
||||
public override UserControl GetControl()
|
||||
{
|
||||
if (UserControl == null)
|
||||
{
|
||||
throw new Exception($"UserControl {this.GetType()} not Ready");
|
||||
}
|
||||
return UserControl;
|
||||
}
|
||||
|
||||
|
||||
public override void ProcessDone()
|
||||
{
|
||||
//clear
|
||||
}
|
||||
|
||||
private void StepDone()
|
||||
{
|
||||
base.currentProcessState = ProductionProcessState.Done;
|
||||
isDone?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void StepMismatch(string msg)
|
||||
{
|
||||
base.currentProcessState = ProductionProcessState.Error;
|
||||
isDone?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void UserControl_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
|
||||
{
|
||||
var a = UserControl.txtHiddenInput.Text;
|
||||
|
||||
UserControl.txtHiddenInput.Text = "";
|
||||
if (a.Trim().Contains(PcbSerialNumber.Trim()))
|
||||
{
|
||||
StepDone();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PcbSerialNumber.Contains("/") && (a.Trim().Contains(PcbSerialNumber.Split('/')[0].Trim()) || a.Trim().Contains(PcbSerialNumber.Split('/')[1].Trim())))
|
||||
{
|
||||
StepDone();
|
||||
}
|
||||
else
|
||||
{
|
||||
StepMismatch($"Falsche oder fehlerhafter Scan! {Environment.NewLine} Dieser Zähler müsste die ({PcbSerialNumber}) haben");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//StepDone();
|
||||
}
|
||||
|
||||
public override async void StartProcess()
|
||||
{
|
||||
PcbSerialNumber = Meter.SerialNumber;
|
||||
UserControl.SetDesc($"Bitte den Deckel des Zählers Scannern{Environment.NewLine} Die Seriennummer muss abgeglichen werden.");
|
||||
UserControl.SetFocusMe();
|
||||
//UserControl.Focus();
|
||||
UserControl.BarcodeInput += UserControl_KeyDown;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
using ProductionUiCordonel.ProductionProcesses.Enum;
|
||||
using ProductionUiCordonel.UserControls.FinalTest;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||
using Xylem.Common.Logic.ProductionOrderCore;
|
||||
using Xylem.Common.Logic.SoftwareAccessHelper;
|
||||
|
||||
namespace ProductionUiCordonel.ProductionProcesses.Actions
|
||||
{
|
||||
public class ProductionProcessConnect : BaseProductionProcess
|
||||
{
|
||||
public Task<IList<ProgrammingParameters>> asyncprogrammingParametersTask;
|
||||
private UcPlain UserControl;
|
||||
private GenesisMeter Meter;
|
||||
public ProductionProcessConnect()
|
||||
{
|
||||
name = "Connect";
|
||||
currentProcessState = ProductionProcessState.Waiting;
|
||||
}
|
||||
public override void InitUserControl()
|
||||
{
|
||||
UserControl = new UcPlain();
|
||||
UserControl.lblHl.Content = name;
|
||||
UserControl.lblText.Content = "";
|
||||
|
||||
}
|
||||
|
||||
public override UserControl GetControl()
|
||||
{
|
||||
if (UserControl == null)
|
||||
{
|
||||
throw new Exception($"UserControl {this.GetType()} not Ready");
|
||||
}
|
||||
return UserControl;
|
||||
}
|
||||
|
||||
|
||||
public override void ProcessDone()
|
||||
{
|
||||
//clear
|
||||
}
|
||||
|
||||
public override void StartProcess()
|
||||
{
|
||||
base.NewStatus($"Prüfe Verbindung");
|
||||
base.Progress = 0;
|
||||
if (!base.Meter.IsLoggedOn)
|
||||
{
|
||||
base.NewStatus($"Login wird gestartet");
|
||||
base.Meter.Login();
|
||||
}
|
||||
//Check access in
|
||||
base.Progress = 50;
|
||||
base.NewStatus($"Zugang wird überprüft");
|
||||
//var res = base.Meter.ReadRegister(Register.Genesisflow.LedMode);
|
||||
//if (res != null && res.Length > 0)
|
||||
//{
|
||||
base.Progress = 100;
|
||||
base.NewStatus($"Zugang verifiziert");
|
||||
currentProcessState = ProductionProcessState.Done;
|
||||
|
||||
asyncprogrammingParametersTask = new Task<IList<ProgrammingParameters>>(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
//var url = $"http://localhost:56011/api/FinalCheck/GetProgrammingParameters?PcbID={base.Meter.PcbId}";
|
||||
var url = $"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetProgrammingParameters?PcbID={base.Meter.PcbId}";
|
||||
var csdRet = LocalWebRequest.GetRequest(url, 80000);
|
||||
|
||||
return Newtonsoft.Json.JsonConvert.DeserializeObject<IList<ProgrammingParameters>>(csdRet);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
return new List<ProgrammingParameters>() { };
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
asyncprogrammingParametersTask.Start();
|
||||
|
||||
|
||||
return;
|
||||
//}
|
||||
currentProcessState = ProductionProcessState.Error;
|
||||
// throw new Exception($"Not able to login");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
using ProductionUiCordonel.ProductionProcesses.Enum;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using ProductionUiCordonel.UserControls.FinalTest;
|
||||
using System.Threading;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
||||
|
||||
namespace ProductionUiCordonel.ProductionProcesses.Actions
|
||||
{
|
||||
public class ProductionProcessDone : BaseProductionProcess
|
||||
{
|
||||
public event EventHandler isDone;
|
||||
private UcDialog UserControl;
|
||||
public DialogResult Result = DialogResult.None;
|
||||
public enum DialogResult
|
||||
{
|
||||
None,
|
||||
Retry,
|
||||
Print,
|
||||
Abort
|
||||
}
|
||||
public bool DialogIsDone { get; private set; }
|
||||
private bool Error = false;
|
||||
public ProductionProcessDone(bool error = false)
|
||||
{
|
||||
Error = error;
|
||||
DialogIsDone = false;
|
||||
name = "Fertig";
|
||||
currentProcessState = ProductionProcessState.Waiting;
|
||||
}
|
||||
public override void InitUserControl()
|
||||
{
|
||||
UserControl = new UcDialog();
|
||||
}
|
||||
|
||||
public override UserControl GetControl()
|
||||
{
|
||||
if (UserControl == null)
|
||||
{
|
||||
throw new Exception($"UserControl {this.GetType()} not Ready");
|
||||
}
|
||||
return UserControl;
|
||||
}
|
||||
|
||||
|
||||
public override void ProcessDone()
|
||||
{
|
||||
//clear
|
||||
}
|
||||
|
||||
private void StepDone()
|
||||
{
|
||||
base.currentProcessState = ProductionProcessState.Done;
|
||||
isDone?.Invoke(null, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void StepError()
|
||||
{
|
||||
|
||||
UserControl.SetDesc("Errors occur");
|
||||
var errorOptionList = new List<UcDialog.DialogOption>();
|
||||
var retry = new UcDialog.DialogOption("Wiederholen", "Alle Schritte werden wiederholt", () =>
|
||||
{
|
||||
Result = DialogResult.Retry;
|
||||
StepDone();
|
||||
|
||||
});
|
||||
|
||||
var Abort = new UcDialog.DialogOption("Abbruch", "Diesen Zähler NICHT verpacken", () =>
|
||||
{
|
||||
Result = DialogResult.Abort;
|
||||
StepDone();
|
||||
|
||||
});
|
||||
var print = new UcDialog.DialogOption("Rückläuferschein drucken", "Rückläuferschein beim Zähler lassen und auf Klärung durch QS warten", () =>
|
||||
{
|
||||
Result = DialogResult.Retry;
|
||||
StepDone();
|
||||
|
||||
});
|
||||
|
||||
|
||||
errorOptionList.Add(retry);
|
||||
errorOptionList.Add(Abort);
|
||||
errorOptionList.Add(print);
|
||||
|
||||
UserControl.SetDialogOptions(errorOptionList);
|
||||
}
|
||||
|
||||
private void StepSuccsess()
|
||||
{
|
||||
|
||||
UserControl.SetDesc("Zähler verpacken");
|
||||
var OptionList = new List<UcDialog.DialogOption>();
|
||||
var retry = new UcDialog.DialogOption("Ok", "", () =>
|
||||
{
|
||||
Result = DialogResult.None;
|
||||
StepDone();
|
||||
|
||||
});
|
||||
|
||||
|
||||
OptionList.Add(retry);
|
||||
|
||||
UserControl.SetDialogOptions(OptionList);
|
||||
}
|
||||
|
||||
public override async void StartProcess()
|
||||
{
|
||||
if (Error)
|
||||
{
|
||||
StepError();
|
||||
}
|
||||
else
|
||||
{
|
||||
StepSuccsess();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,364 @@
|
||||
using Newtonsoft.Json;
|
||||
using ProductionUiCordonel.ProductionProcesses.Enum;
|
||||
using ProductionUiCordonel.UserControls.FinalTest;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
||||
|
||||
namespace ProductionUiCordonel.ProductionProcesses.Actions
|
||||
{
|
||||
public class ProductionProcessFinalParameterization : BaseProductionProcess
|
||||
{
|
||||
private UcPlain UserControl;
|
||||
public ProductionProcessFinalParameterization()
|
||||
{
|
||||
name = "Final Parameterization";
|
||||
currentProcessState = ProductionProcessState.Waiting;
|
||||
}
|
||||
public override void InitUserControl()
|
||||
{
|
||||
UserControl = new UcPlain();
|
||||
}
|
||||
|
||||
public override UserControl GetControl()
|
||||
{
|
||||
if (UserControl == null)
|
||||
{
|
||||
throw new Exception($"UserControl {this.GetType()} not Ready");
|
||||
}
|
||||
return UserControl;
|
||||
}
|
||||
|
||||
|
||||
public override void ProcessDone()
|
||||
{
|
||||
//clear
|
||||
}
|
||||
|
||||
public Task<Tuple<String, Boolean>> _currentGenesis_WriteRegister<T>(String reg, T value, Boolean waitForResult = true,
|
||||
Boolean checkRegister = false)
|
||||
{
|
||||
return new Task<Tuple<String, Boolean>>(() =>
|
||||
{
|
||||
|
||||
var ret = Meter.WriteRegister(reg, value, waitForResult, checkRegister);
|
||||
if (!ret)
|
||||
{
|
||||
ret = Meter.WriteRegister(reg, value, waitForResult, checkRegister);
|
||||
}
|
||||
return new Tuple<String, Boolean>(reg, ret);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public Task<Tuple<String, Boolean>> wirteRegisterInBetweenCheck(String reg, Int32 value, Boolean waitForResult = true,
|
||||
Boolean checkRegister = false, int addToCheck = 10, int addFromCheck = 0)
|
||||
{
|
||||
return new Task<Tuple<String, Boolean>>(() =>
|
||||
{
|
||||
Meter.WriteRegister(reg, value, waitForResult);
|
||||
|
||||
var accucalValue = RegisterConverter.ConvertTo<Int32>(Meter.ReadRegister(reg));
|
||||
if (accucalValue >= (value + addFromCheck) && value <= accucalValue + (addToCheck))
|
||||
{
|
||||
return new Tuple<String, Boolean>(reg, true);
|
||||
}
|
||||
return new Tuple<String, Boolean>(reg, false);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public override void StartProcess()
|
||||
{
|
||||
|
||||
|
||||
base.Progress = 0;
|
||||
|
||||
var useRadio = true;
|
||||
var radioParams = new RadioConfigurationParams();
|
||||
if (useRadio)
|
||||
{
|
||||
|
||||
|
||||
|
||||
var url = ServiceUrls.GenesisFinalCheckServiceUrl();
|
||||
url = url + $"GetRadioConfiguration?PcbId={Meter.PcbId}";
|
||||
|
||||
|
||||
var http = (HttpWebRequest)WebRequest.Create(url);
|
||||
http.Method = "GET";
|
||||
http.Timeout = 2000;
|
||||
var response = (HttpWebResponse)http.GetResponse();
|
||||
var responseStream = response.GetResponseStream();
|
||||
if (responseStream == null)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
using (var sr = new StreamReader(responseStream))
|
||||
{
|
||||
var responseJson = sr.ReadToEnd();
|
||||
radioParams = JsonConvert.DeserializeObject<RadioConfigurationParams>(responseJson);
|
||||
}
|
||||
}
|
||||
base.Progress = 20;
|
||||
|
||||
|
||||
|
||||
|
||||
var overAllResult = new List<Task<Tuple<String, Boolean>>>();
|
||||
//611.219.280
|
||||
//
|
||||
var ts = DateTimeOffset.UtcNow - new DateTimeOffset(2000, 1, 1, 0, 0, 0, new TimeSpan(0));
|
||||
|
||||
//Alarms
|
||||
////_currentGenesis.WriteRegister("SENSUSRADIO_MainAlarmMask?
|
||||
////_currentGenesis.WriteRegister("SENSUSRADIO_ExtendedAlarmMask ?
|
||||
//CUSTOMER_AlarmBroadcastMask?
|
||||
//CUSTOMER_AlarmEnableMask ?
|
||||
//CUSTOMER_AlarmVisualAutoClearMask?
|
||||
//CUSTOMER_AlarmVisualMask ?
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_SealDisplay",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
|
||||
//Meter.SetLcdText(true, null);
|
||||
//overAllResult.Add(_currentGenesis_WriteRegister(Register.Customer.TriggerAlarmCancel,
|
||||
// (new Byte[] { 0xFF, 0xFF, 0xFF, 0xFF }).Reverse().ToArray(), true, false));
|
||||
|
||||
|
||||
|
||||
overAllResult.Add(wirteRegisterInBetweenCheck("CUSTOMER_LeakFlowThreshold", 375, true, true, 1, -1));
|
||||
overAllResult.Add(wirteRegisterInBetweenCheck("CUSTOMER_ExcessFlowVolumeThreshold", 25000, true, true, 1, -1));
|
||||
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_ExcessFlowTimeThreshold",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x05 }).Reverse().ToArray(), true, true));
|
||||
|
||||
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_LeakTimeThreshold",
|
||||
(new Byte[] { 0x00, 0x00, 0x4E, 0xC0 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_Locale",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0xD0 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_PressureHighDelay",
|
||||
(new Byte[] { 0x00, 0x00, 0x02, 0x58 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_PressureHighThreshold",
|
||||
(new Byte[] { 0x00, 0x0B, 0x71, 0xB0 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_PressureLowDelay",
|
||||
(new Byte[] { 0x00, 0x00, 0x02, 0x58 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_PressureLowThreshold",
|
||||
(new Byte[] { 0x00, 0x00, 0x75, 0x30 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_ReverseFlowTimeThreshold",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x78 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_TemperatureHighDelay",
|
||||
(new Byte[] { 0x00, 0x00, 0x01, 0x2C }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_TemperatureHighThreshold",
|
||||
(new Byte[] { 0x00, 0x00, 0x01, 0xF4 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_TemperatureLowDelay",
|
||||
(new Byte[] { 0x00, 0x00, 0x01, 0x2C }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_TemperatureLowThreshold",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x14 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_ArrowThreshold",
|
||||
(new Byte[] { 0x00, 0x1E, 0x84, 0x80 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_DisplayPow10",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0xFD }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_DisplayUnits",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_ForwardArrow",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_HardErrorLimit",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x04 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_LedMode",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
|
||||
//overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_LowFlowMaxPeriod", (new Byte[] { 0x00, 0x00, 0x00, 0x3C }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_LowFlowMaxPeriod", 60 << 16, true, true));
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_LowFlowThreshold",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0xC8 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_MeterSize",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_PipeFillingDelay",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x1E }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_ResetAccumulators",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, false));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_SampleRate",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x02 }).Reverse().ToArray(), true, true));
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_UpdateThreshold",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("IRDA_AdapterPresenceLimit",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x60 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("IRDA_PulseReportRate",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_FlowPoint",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x02 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_FlowUnits",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x04 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_PressureOffset",
|
||||
(new Byte[] { 0x00, 0x00, 0x03, 0xF5 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_PressurePresent",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_PressureRate",
|
||||
(new Byte[] { 0x00, 0x0D, 0xBB, 0xA0 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_PressureUnits",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_PulseLength",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x07 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_PulseMode",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_PulseWeight",
|
||||
(new Byte[] { 0x00, 0x00, 0x27, 0x10 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_TemperatureUnits",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_AverageFlowPeriod",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x05 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_DataLogContents",
|
||||
(new Byte[] { 0x0C, 0x00, 0x24, 0x03 }).Reverse().ToArray(), true, false));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_DataLogPeriod",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x3C }).Reverse().ToArray(), true, false));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_FixedDateDayOfMonth",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, false));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_FixedDateReadingContents",
|
||||
(new Byte[] { 0x0C, 0x00, 0x24, 0x03 }).Reverse().ToArray(), true, false));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_PeriodicLogLifeTimeCounter",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x0 }).Reverse().ToArray(), true, false));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_ResetCounter",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x0 }).Reverse().ToArray(), true, true));
|
||||
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("POWERMON_BatterySelection",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, false));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("POWERMON_WarnFromClamp",
|
||||
(new Byte[] { 0x25, 0x89, 0x06, 0x00 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_WakeupInterval",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x03 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_MbusState",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x07 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_UtcTimeOffset",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
|
||||
|
||||
//// just read later //overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_FrequencyIndicator}).Reverse(), true, true);
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_HistoricalAlarmsDays",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x1D }).Reverse().ToArray(), true, true));
|
||||
|
||||
|
||||
//Original
|
||||
//0x11, 0x12, 0x13, 0x14, 0x21, 0x22, 0x23, 0x24, 0x31, 0x32, 0x33, 0x34, 0x41, 0x42, 0x43, 0x44
|
||||
//Write to register
|
||||
//0x14, 0x13, 0x12, 0x11, 0x24, 0x23, 0x22, 0x21, 0x34, 0x33, 0x32, 0x31, 0x44, 0x43, 0x42, 0x41
|
||||
|
||||
|
||||
//good one
|
||||
//E6-C8-88-00-DE-B8-68-C0-D6-A8-48-80-CE-98-28-40
|
||||
//0E-05-04-04-00-14-30-68-D0-14-0E-80-40-63-93-73-22
|
||||
|
||||
//&bad one
|
||||
//0E-05-04-05-00-00-88-C8-E6-C0-68-B8-DE-80-48-A8-D6-40-28-98-CE
|
||||
|
||||
|
||||
//0E-05-04-04-00-22-73-93-63-40-80-0E-14-D0-68-30-14
|
||||
|
||||
if (useRadio)
|
||||
{
|
||||
|
||||
|
||||
//var funkadresse = new List<byte>();
|
||||
//funkadresse.AddRange((new Byte[] { 0xE6, 0xC8, 0x88, 0x00 }).ToArray());
|
||||
//funkadresse.AddRange((new Byte[] { 0xDE, 0xB8, 0x68, 0xC0 }).ToArray());
|
||||
//funkadresse.AddRange((new Byte[] { 0xD6, 0xA8, 0x48, 0x80 }).ToArray());
|
||||
//funkadresse.AddRange((new Byte[] { 0xCE, 0x98, 0x28, 0x40 }).ToArray());
|
||||
//overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_EncryptionKey", funkadresse.ToArray(),
|
||||
// true, true));
|
||||
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_EncryptionKey",
|
||||
(new Byte[]
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
}).ToArray(), true, true));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_RadioAddress", radioParams.RadioAddress, true, true));
|
||||
|
||||
if (radioParams.PowerLevel > 0 && radioParams.PowerLevelOption > 0 && radioParams.ImpedanceCodeNew > 0 && radioParams.ImpedanceCodeOption > 0)
|
||||
{
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_PowerLevel", radioParams.PowerLevel, true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_PowerLevelOption", radioParams.PowerLevelOption, true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_ImpedanceCodeNew", radioParams.ImpedanceCodeNew, true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_ImpedanceCodeOption", radioParams.ImpedanceCodeOption, true, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
base.currentProcessState = ProductionProcessState.Error;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//_currentGenesis_WriteRegister("SENSUSRADIO_CustomerText",
|
||||
// (new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, false);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
overAllResult.Add(wirteRegisterInBetweenCheck("SYSTEM_CalendarSeconds", Convert.ToInt32(ts.TotalSeconds)));
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_SealDisplay",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, true));
|
||||
|
||||
////radio end state!
|
||||
//overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_SystemState",
|
||||
// (new Byte[] { 0x00, 0x00, 0x00, 0xFF }).Reverse().ToArray(), true, false));
|
||||
|
||||
//overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_SystemState",
|
||||
// (new Byte[] { 0x00, 0x00, 0x00, 0x02 }).Reverse().ToArray(), true, true));
|
||||
|
||||
|
||||
|
||||
var ret = true;
|
||||
int done = 0;
|
||||
foreach (var cTask in overAllResult)
|
||||
{
|
||||
cTask.RunSynchronously();
|
||||
if (cTask.Result.Item2)
|
||||
{
|
||||
base.NewStatus($"set Parameter {cTask.Result.Item1} succeed");
|
||||
}
|
||||
else
|
||||
{
|
||||
base.NewStatus($"set Parameter {cTask.Result.Item1} failed");
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
|
||||
base.Progress = 20 + ((Int32)Math.Round(((Double)done / (Double)overAllResult.Count) * 80, 0));
|
||||
done = done + 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
base.currentProcessState = ProductionProcessState.Error;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentProcessState = ProductionProcessState.Done;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,384 @@
|
||||
using Newtonsoft.Json;
|
||||
using ProductionUiCordonel.ProductionProcesses.Enum;
|
||||
using ProductionUiCordonel.UserControls.FinalTest;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
||||
|
||||
namespace ProductionUiCordonel.ProductionProcesses.Actions
|
||||
{
|
||||
public class ProductionProcessFinalParameterizationFix : BaseProductionProcess
|
||||
{
|
||||
private UcPlain UserControl;
|
||||
public ProductionProcessFinalParameterizationFix()
|
||||
{
|
||||
name = "Final Parameterization";
|
||||
currentProcessState = ProductionProcessState.Waiting;
|
||||
}
|
||||
public override void InitUserControl()
|
||||
{
|
||||
UserControl = new UcPlain();
|
||||
}
|
||||
|
||||
public override UserControl GetControl()
|
||||
{
|
||||
if (UserControl == null)
|
||||
{
|
||||
throw new Exception($"UserControl {this.GetType()} not Ready");
|
||||
}
|
||||
return UserControl;
|
||||
}
|
||||
|
||||
|
||||
public override void ProcessDone()
|
||||
{
|
||||
//clear
|
||||
}
|
||||
|
||||
public Task<Tuple<String, Boolean>> _currentGenesis_WriteRegister<T>(String reg, T value, Boolean waitForResult = true,
|
||||
Boolean checkRegister = false)
|
||||
{
|
||||
return new Task<Tuple<String, Boolean>>(() =>
|
||||
{
|
||||
|
||||
var ret = Meter.WriteRegister(reg, value, waitForResult, checkRegister);
|
||||
if (!ret)
|
||||
{
|
||||
ret = Meter.WriteRegister(reg, value, waitForResult, checkRegister);
|
||||
}
|
||||
return new Tuple<String, Boolean>(reg, ret);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public Task<Tuple<String, Boolean>> wirteRegisterInBetweenCheck(String reg, Int32 value, Boolean waitForResult = true,
|
||||
Boolean checkRegister = false, int addToCheck = 10, int addFromCheck = 0)
|
||||
{
|
||||
return new Task<Tuple<String, Boolean>>(() =>
|
||||
{
|
||||
Meter.WriteRegister(reg, value, waitForResult);
|
||||
|
||||
var accucalValue = RegisterConverter.ConvertTo<Int32>(Meter.ReadRegister(reg));
|
||||
if (accucalValue >= (value + addFromCheck) && value <= accucalValue + (addToCheck))
|
||||
{
|
||||
return new Tuple<String, Boolean>(reg, true);
|
||||
}
|
||||
return new Tuple<String, Boolean>(reg, false);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public override void StartProcess()
|
||||
{
|
||||
|
||||
|
||||
base.Progress = 0;
|
||||
|
||||
var useRadio = true;
|
||||
var radioParams = new RadioConfigurationParams();
|
||||
if (useRadio)
|
||||
{
|
||||
|
||||
|
||||
|
||||
var url = ServiceUrls.GenesisFinalCheckServiceUrl();
|
||||
url = "http://localhost:56011/api/FinalCheck/";
|
||||
url = url + $"GetRadioConfiguration?PcbId={Meter.PcbId}&withPressure=false";
|
||||
|
||||
|
||||
var http = (HttpWebRequest)WebRequest.Create(url);
|
||||
http.Method = "GET";
|
||||
http.Timeout = 20000;
|
||||
var response = (HttpWebResponse)http.GetResponse();
|
||||
var responseStream = response.GetResponseStream();
|
||||
if (responseStream == null)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
using (var sr = new StreamReader(responseStream))
|
||||
{
|
||||
var responseJson = sr.ReadToEnd();
|
||||
radioParams = JsonConvert.DeserializeObject<RadioConfigurationParams>(responseJson);
|
||||
}
|
||||
}
|
||||
base.Progress = 20;
|
||||
|
||||
|
||||
|
||||
|
||||
var overAllResult = new List<Task<Tuple<String, Boolean>>>();
|
||||
//611.219.280
|
||||
//
|
||||
|
||||
//Alarms
|
||||
////_currentGenesis.WriteRegister("SENSUSRADIO_MainAlarmMask?
|
||||
////_currentGenesis.WriteRegister("SENSUSRADIO_ExtendedAlarmMask ?
|
||||
//CUSTOMER_AlarmBroadcastMask?
|
||||
//CUSTOMER_AlarmEnableMask ?
|
||||
//CUSTOMER_AlarmVisualAutoClearMask?
|
||||
//CUSTOMER_AlarmVisualMask ?
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_SealDisplay",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
|
||||
//Meter.SetLcdText(true, null);
|
||||
//overAllResult.Add(_currentGenesis_WriteRegister(Register.Customer.TriggerAlarmCancel,
|
||||
// (new Byte[] { 0xFF, 0xFF, 0xFF, 0xFF }).Reverse().ToArray(), true, false));
|
||||
|
||||
|
||||
|
||||
overAllResult.Add(wirteRegisterInBetweenCheck("CUSTOMER_LeakFlowThreshold", 375, true, true, 1, -1));
|
||||
overAllResult.Add(wirteRegisterInBetweenCheck("CUSTOMER_ExcessFlowVolumeThreshold", 25000, true, true, 1, -1));
|
||||
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_ExcessFlowTimeThreshold",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x05 }).Reverse().ToArray(), true, true));
|
||||
|
||||
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_LeakTimeThreshold",
|
||||
(new Byte[] { 0x00, 0x00, 0x4E, 0xC0 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_Locale",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0xD0 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_PressureHighDelay",
|
||||
(new Byte[] { 0x00, 0x00, 0x02, 0x58 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_PressureHighThreshold",
|
||||
(new Byte[] { 0x00, 0x0B, 0x71, 0xB0 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_PressureLowDelay",
|
||||
(new Byte[] { 0x00, 0x00, 0x02, 0x58 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_PressureLowThreshold",
|
||||
(new Byte[] { 0x00, 0x00, 0x75, 0x30 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_ReverseFlowTimeThreshold",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x78 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_TemperatureHighDelay",
|
||||
(new Byte[] { 0x00, 0x00, 0x01, 0x2C }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_TemperatureHighThreshold",
|
||||
(new Byte[] { 0x00, 0x00, 0x01, 0xF4 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_TemperatureLowDelay",
|
||||
(new Byte[] { 0x00, 0x00, 0x01, 0x2C }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("CUSTOMER_TemperatureLowThreshold",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x14 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_ArrowThreshold",
|
||||
(new Byte[] { 0x00, 0x1E, 0x84, 0x80 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_DisplayPow10",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0xFD }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_DisplayUnits",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
|
||||
if (useRadio)
|
||||
{
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_ForwardArrow",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
|
||||
}
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_HardErrorLimit",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x04 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_LedMode",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
|
||||
//overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_LowFlowMaxPeriod", (new Byte[] { 0x00, 0x00, 0x00, 0x3C }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_LowFlowMaxPeriod", 60 << 16, true, true));
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_LowFlowThreshold",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0xC8 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_MeterSize",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_PipeFillingDelay",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x1E }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_ResetAccumulators",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, false));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_SampleRate",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x02 }).Reverse().ToArray(), true, true));
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_MinValidAmplitude",
|
||||
(new Byte[] { 0x25, 0x80, 0x00, 0x00 }).Reverse().ToArray(), true, true));
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_MaxValidDeltaToF",
|
||||
(new Byte[] { 0x00, 0x03, 0xC6, 0x5E }).Reverse().ToArray(), true, true));
|
||||
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_UpdateThreshold",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("IRDA_AdapterPresenceLimit",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x60 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("IRDA_PulseReportRate",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_FlowPoint",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x02 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_FlowUnits",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x04 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_PressureOffset",
|
||||
(new Byte[] { 0x00, 0x00, 0x03, 0xF5 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_PressurePresent",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_PressureRate",
|
||||
(new Byte[] { 0x00, 0x0D, 0xBB, 0xA0 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_PressureUnits",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_PulseLength",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x07 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_PulseMode",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_PulseWeight",
|
||||
(new Byte[] { 0x00, 0x00, 0x27, 0x10 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_TemperatureUnits",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
|
||||
|
||||
|
||||
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("POWERMON_BatterySelection",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, false));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("POWERMON_WarnFromClamp",
|
||||
(new Byte[] { 0x25, 0x89, 0x06, 0x00 }).Reverse().ToArray(), true, true));
|
||||
|
||||
|
||||
//// just read later //overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_FrequencyIndicator}).Reverse(), true, true);
|
||||
|
||||
|
||||
|
||||
//Original
|
||||
//0x11, 0x12, 0x13, 0x14, 0x21, 0x22, 0x23, 0x24, 0x31, 0x32, 0x33, 0x34, 0x41, 0x42, 0x43, 0x44
|
||||
//Write to register
|
||||
//0x14, 0x13, 0x12, 0x11, 0x24, 0x23, 0x22, 0x21, 0x34, 0x33, 0x32, 0x31, 0x44, 0x43, 0x42, 0x41
|
||||
|
||||
|
||||
//good one
|
||||
//E6-C8-88-00-DE-B8-68-C0-D6-A8-48-80-CE-98-28-40
|
||||
//0E-05-04-04-00-14-30-68-D0-14-0E-80-40-63-93-73-22
|
||||
|
||||
//&bad one
|
||||
//0E-05-04-05-00-00-88-C8-E6-C0-68-B8-DE-80-48-A8-D6-40-28-98-CE
|
||||
|
||||
|
||||
//0E-05-04-04-00-22-73-93-63-40-80-0E-14-D0-68-30-14
|
||||
|
||||
if (useRadio)
|
||||
{
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_WakeupInterval",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x03 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_MbusState",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x07 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_UtcTimeOffset",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_HistoricalAlarmsDays",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x1D }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_AverageFlowPeriod",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x05 }).Reverse().ToArray(), true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_DataLogContents",
|
||||
(new Byte[] { 0x0C, 0x00, 0x24, 0x03 }).Reverse().ToArray(), true, false));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_DataLogPeriod",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x3C }).Reverse().ToArray(), true, false));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_FixedDateDayOfMonth",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, false));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_FixedDateReadingContents",
|
||||
(new Byte[] { 0x0C, 0x00, 0x24, 0x03 }).Reverse().ToArray(), true, false));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_PeriodicLogLifeTimeCounter",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x0 }).Reverse().ToArray(), true, false));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_ResetCounter",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x0 }).Reverse().ToArray(), true, true));
|
||||
|
||||
//var funkadresse = new List<byte>();
|
||||
//funkadresse.AddRange((new Byte[] { 0xE6, 0xC8, 0x88, 0x00 }).ToArray());
|
||||
//funkadresse.AddRange((new Byte[] { 0xDE, 0xB8, 0x68, 0xC0 }).ToArray());
|
||||
//funkadresse.AddRange((new Byte[] { 0xD6, 0xA8, 0x48, 0x80 }).ToArray());
|
||||
//funkadresse.AddRange((new Byte[] { 0xCE, 0x98, 0x28, 0x40 }).ToArray());
|
||||
//overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_EncryptionKey", funkadresse.ToArray(),
|
||||
// true, true));
|
||||
|
||||
|
||||
//overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_EncryptionKey",
|
||||
// (new Byte[]
|
||||
// {
|
||||
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
// }).ToArray(), true, true));
|
||||
|
||||
|
||||
|
||||
var funkadresse = new List<byte>();
|
||||
funkadresse.AddRange((new Byte[] { 0x0E, 0x9F, 0xAC, 0xC6 }).ToArray());
|
||||
funkadresse.AddRange((new Byte[] { 0xA0, 0xE1, 0xEF, 0x1C }).ToArray());
|
||||
funkadresse.AddRange((new Byte[] { 0x3B, 0x27, 0xA4, 0x9B }).ToArray());
|
||||
funkadresse.AddRange((new Byte[] { 0xAC, 0x21, 0x65, 0x35 }).ToArray());
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_EncryptionKey", funkadresse.ToArray(), true, true));
|
||||
|
||||
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_RadioAddress", radioParams.RadioAddress, true, true));
|
||||
|
||||
if (radioParams.PowerLevel > 0 && radioParams.PowerLevelOption > 0 && radioParams.ImpedanceCodeNew > 0 && radioParams.ImpedanceCodeOption > 0)
|
||||
{
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_PowerLevel", radioParams.PowerLevel, true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_PowerLevelOption", radioParams.PowerLevelOption, true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_ImpedanceCodeNew", radioParams.ImpedanceCodeNew, true, true));
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_ImpedanceCodeOption", radioParams.ImpedanceCodeOption, true, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
base.currentProcessState = ProductionProcessState.Error;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//_currentGenesis_WriteRegister("SENSUSRADIO_CustomerText",
|
||||
// (new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, false);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
var ts = DateTimeOffset.UtcNow - new DateTimeOffset(2000, 1, 1, 0, 0, 0, new TimeSpan(0));
|
||||
overAllResult.Add(wirteRegisterInBetweenCheck("SYSTEM_CalendarSeconds", Convert.ToInt32(ts.TotalSeconds)));
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_SealDisplay",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, true));
|
||||
|
||||
////radio end state!
|
||||
//overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_SystemState",
|
||||
// (new Byte[] { 0x00, 0x00, 0x00, 0xFF }).Reverse().ToArray(), true, false));
|
||||
|
||||
//overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_SystemState",
|
||||
// (new Byte[] { 0x00, 0x00, 0x00, 0x02 }).Reverse().ToArray(), true, true));
|
||||
|
||||
|
||||
|
||||
var ret = true;
|
||||
int done = 0;
|
||||
foreach (var cTask in overAllResult)
|
||||
{
|
||||
cTask.RunSynchronously();
|
||||
if (cTask.Result.Item2)
|
||||
{
|
||||
base.NewStatus($"set Parameter {cTask.Result.Item1} succeed");
|
||||
}
|
||||
else
|
||||
{
|
||||
base.NewStatus($"set Parameter {cTask.Result.Item1} failed");
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
|
||||
base.Progress = 20 + ((Int32)Math.Round(((Double)done / (Double)overAllResult.Count) * 80, 0));
|
||||
done = done + 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
base.currentProcessState = ProductionProcessState.Error;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentProcessState = ProductionProcessState.Done;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,294 @@
|
||||
using ProductionUiCordonel.ProductionProcesses.Enum;
|
||||
using ProductionUiCordonel.UserControls.FinalTest;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
||||
using Xylem.Common.Logic.ProductionOrderCore;
|
||||
using Xylem.Common.Logic.SoftwareAccessHelper;
|
||||
|
||||
namespace ProductionUiCordonel.ProductionProcesses.Actions
|
||||
{
|
||||
public class ProductionProcessFinalParameterizationVakoCsd : BaseProductionProcess
|
||||
{
|
||||
private UcPlain UserControl;
|
||||
private ProductionProcessConnect connectProcess;
|
||||
|
||||
|
||||
public ProductionProcessFinalParameterizationVakoCsd(ProductionProcessConnect connectProcess)
|
||||
{
|
||||
this.connectProcess = connectProcess;
|
||||
name = "Kunden Parametrierung";
|
||||
currentProcessState = ProductionProcessState.Waiting;
|
||||
|
||||
}
|
||||
|
||||
public override void InitUserControl()
|
||||
{
|
||||
UserControl = new UcPlain();
|
||||
UserControl.lblHl.Content = name;
|
||||
UserControl.lblText.Content = "Kann bis zu 1 Minute dauern!";
|
||||
}
|
||||
|
||||
public override UserControl GetControl()
|
||||
{
|
||||
if (UserControl == null)
|
||||
{
|
||||
throw new Exception($"UserControl {this.GetType()} not Ready");
|
||||
}
|
||||
return UserControl;
|
||||
}
|
||||
|
||||
|
||||
public override void ProcessDone()
|
||||
{
|
||||
//clear
|
||||
}
|
||||
|
||||
public Task<Tuple<String, Boolean>> _currentGenesis_WriteRegister<T>(String reg, T value, Boolean waitForResult = true,
|
||||
Boolean checkRegister = false)
|
||||
{
|
||||
return new Task<Tuple<String, Boolean>>(() =>
|
||||
{
|
||||
|
||||
|
||||
Task.Delay(10).Wait();
|
||||
var ret = Meter.WriteRegister(reg, value, waitForResult, checkRegister);
|
||||
if (!ret)
|
||||
{
|
||||
ret = Meter.WriteRegister(reg, value, waitForResult, checkRegister);
|
||||
}
|
||||
return new Tuple<String, Boolean>(reg, ret);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public Task<Tuple<String, Boolean>> wirteRegisterInBetweenCheck(String reg, Int32 value, Boolean waitForResult = true,
|
||||
Boolean checkRegister = false, int addToCheck = 10, int addFromCheck = 0)
|
||||
{
|
||||
return new Task<Tuple<String, Boolean>>(() =>
|
||||
{
|
||||
Meter.WriteRegister(reg, value, waitForResult);
|
||||
|
||||
var accucalValue = RegisterConverter.ConvertTo<Int32>(Meter.ReadRegister(reg));
|
||||
if (accucalValue >= (value + addFromCheck) && value <= accucalValue + (addToCheck))
|
||||
{
|
||||
return new Tuple<String, Boolean>(reg, true);
|
||||
}
|
||||
return new Tuple<String, Boolean>(reg, false);
|
||||
});
|
||||
}
|
||||
|
||||
private void doStartProcessLoop()
|
||||
{
|
||||
var reTrysLeft = 4;
|
||||
while (reTrysLeft >= 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
while (connectProcess.asyncprogrammingParametersTask.Status == TaskStatus.Running)
|
||||
{
|
||||
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
if (connectProcess.asyncprogrammingParametersTask.Status == TaskStatus.RanToCompletion
|
||||
&& connectProcess.asyncprogrammingParametersTask.Result != null
|
||||
&& connectProcess.asyncprogrammingParametersTask.Result.Any())
|
||||
{
|
||||
var myJsonResponse = connectProcess.asyncprogrammingParametersTask.Result;
|
||||
|
||||
base.Progress = 15;
|
||||
|
||||
//fix
|
||||
// CUSTOMER_LeakFlowThreshold
|
||||
//CUSTOMER_ExcessFlowVolumeThreshold
|
||||
|
||||
var overAllResult = new List<Task<Tuple<String, Boolean>>>();
|
||||
//611.219.280
|
||||
//
|
||||
var ts = DateTimeOffset.UtcNow - new DateTimeOffset(2000, 1, 1, 0, 0, 0, new TimeSpan(0));
|
||||
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_SealDisplay",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_PressurePresent",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, false));
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_PressurePresent",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, false));
|
||||
|
||||
foreach (var item in myJsonResponse.Where(m => m.Source == ProgrammingSource.Vako))
|
||||
{
|
||||
if (!item.RegisterName.Contains("GENESISFLOW_DisplayPow10")
|
||||
&& !item.RegisterName.ToLower().Contains("apparrangement")
|
||||
&& !item.RegisterName.ToLower().Contains("SENSUSRADIO_RadioAddress")
|
||||
)
|
||||
{
|
||||
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister(item.RegisterName, item.RegisterValue.Reverse().ToArray(), true, true));
|
||||
}
|
||||
if (item.RegisterName.Contains("pulse"))
|
||||
{
|
||||
|
||||
}
|
||||
if (item.RegisterName.Contains("SENSUSRADIO_RadioAddress"))
|
||||
{
|
||||
overAllResult.Add(_currentGenesis_WriteRegister(item.RegisterName, item.RegisterValue.Reverse().ToArray(), true, true));
|
||||
}
|
||||
if (item.RegisterName.Contains("GENESISFLOW_DisplayPow10"))
|
||||
{
|
||||
overAllResult.Add(_currentGenesis_WriteRegister(item.RegisterName, 253, true, true));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
foreach (var item in myJsonResponse.Where(m => m.Source == ProgrammingSource.Csd))
|
||||
{
|
||||
if (!item.RegisterName.Contains("GENESISFLOW_DisplayPow10")
|
||||
&& !item.RegisterName.ToLower().Contains("apparrangement")
|
||||
&& !item.RegisterName.ToLower().Contains("SENSUSRADIO_RadioAddress")
|
||||
&& !item.RegisterName.ToLower().Contains("SENSUSRADIO_EncryptionKey")
|
||||
|
||||
)
|
||||
{
|
||||
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister(item.RegisterName, item.RegisterValue.Reverse().ToArray(), true, true));
|
||||
}
|
||||
if (item.RegisterName.Contains("SENSUSRADIO_EncryptionKey"))
|
||||
{
|
||||
overAllResult.Add(_currentGenesis_WriteRegister(item.RegisterName, item.RegisterValue.ToArray(), true, true));
|
||||
|
||||
}
|
||||
if (item.RegisterName.Contains("pulse"))
|
||||
{
|
||||
|
||||
}
|
||||
if (item.RegisterName.Contains("SENSUSRADIO_RadioAddress"))
|
||||
{
|
||||
overAllResult.Add(_currentGenesis_WriteRegister(item.RegisterName, item.RegisterValue.Reverse().ToArray(), true, true));
|
||||
}
|
||||
if (item.RegisterName.Contains("SENSUSRADIO_RadioAddress"))
|
||||
{
|
||||
overAllResult.Add(_currentGenesis_WriteRegister(item.RegisterName, item.RegisterValue.Reverse().ToArray(), true, true));
|
||||
}
|
||||
if (item.RegisterName.Contains("GENESISFLOW_DisplayPow10"))
|
||||
{
|
||||
overAllResult.Add(_currentGenesis_WriteRegister(item.RegisterName, 253, true, true));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_ResetAccumulators",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, false));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
overAllResult.Add(wirteRegisterInBetweenCheck("SYSTEM_CalendarSeconds", Convert.ToInt32(ts.TotalSeconds)));
|
||||
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("LOGGER_TriggerLogFlush",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, false));
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("NFC_EraseRMA",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, false));
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_ResetCounter",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, false));
|
||||
|
||||
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_SealDisplay",
|
||||
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, true));
|
||||
|
||||
|
||||
var ret = true;
|
||||
int done = 0;
|
||||
|
||||
foreach (var cTask in overAllResult)
|
||||
{
|
||||
try
|
||||
{
|
||||
//Thread.Sleep(2500);
|
||||
cTask.RunSynchronously();
|
||||
if (cTask.Result.Item2)
|
||||
{
|
||||
base.NewStatus($"Schreiben des Parameter {cTask.Result.Item1} war erfolgreich");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cTask.Result.Item1.ToLower() == "SENSUSRADIO_MetroRadioLifeTimeCounter".ToLower() || cTask.Result.Item1.ToLower() == "CUSTOMER_LeakFlowThreshold".ToLower() || cTask.Result.Item1.ToLower() == "CUSTOMER_ExcessFlowVolumeThreshold".ToLower())
|
||||
{
|
||||
base.NewStatus($"Warnung!Schreiben des Parameter {cTask.Result.Item1} war nicht erfolgreich");
|
||||
}
|
||||
else
|
||||
{
|
||||
base.NewStatus($"Warnung!Schreiben des Parameter {cTask.Result.Item1} war nicht erfolgreich");
|
||||
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
|
||||
base.Progress = 15 + ((Int32)Math.Round(((Double)done / (Double)overAllResult.Count) * 85, 0));
|
||||
done = done + 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
currentProcessState = ProductionProcessState.Done;
|
||||
return;
|
||||
}
|
||||
reTrysLeft = reTrysLeft - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.currentProcessState = ProductionProcessState.Error;
|
||||
reTrysLeft = 0;
|
||||
base.NewStatus($"Warnung!Fehler beim laden des Parametersatzes");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
base.currentProcessState = ProductionProcessState.Error;
|
||||
reTrysLeft = reTrysLeft - 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public override void StartProcess()
|
||||
{
|
||||
doStartProcessLoop();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
using ProductionUiCordonel.ProductionProcesses.Enum;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using ProductionUiCordonel.UserControls.FinalTest;
|
||||
using System.Threading;
|
||||
using System.Windows.Threading;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
||||
|
||||
namespace ProductionUiCordonel.ProductionProcesses.Actions
|
||||
{
|
||||
public class ProductionProcessFullReadOut : BaseProductionProcess
|
||||
{
|
||||
private UcFullReadOut UserControl;
|
||||
public ProductionProcessFullReadOut()
|
||||
{
|
||||
name = "Sicherung des Zählerzustandes";
|
||||
currentProcessState = ProductionProcessState.Waiting;
|
||||
}
|
||||
|
||||
public override void InitUserControl()
|
||||
{
|
||||
UserControl = new UcFullReadOut();
|
||||
}
|
||||
|
||||
public override UserControl GetControl()
|
||||
{
|
||||
if (UserControl == null)
|
||||
{
|
||||
throw new Exception($"UserControl {this.GetType()} not Ready");
|
||||
}
|
||||
return UserControl;
|
||||
}
|
||||
|
||||
public override void ProcessDone()
|
||||
{
|
||||
//clear
|
||||
}
|
||||
|
||||
public override void StartProcess()
|
||||
{
|
||||
try
|
||||
{
|
||||
UserControl.lblHl.Dispatcher.Invoke(DispatcherPriority.Send,
|
||||
new Action(() => { UserControl.lblHl.Content = "Read out Registers"; }
|
||||
));
|
||||
var oldConfigEntry = Meter._configuration.UseRegisterWatchService;
|
||||
if (oldConfigEntry)
|
||||
{
|
||||
Meter._configuration.UseRegisterWatchService = false;
|
||||
}
|
||||
|
||||
var total = Meter.GetRegistersDic().Keys.ToList();
|
||||
var done = 0;
|
||||
foreach (var dic in total)
|
||||
{
|
||||
try
|
||||
{
|
||||
UserControl.lblText.Dispatcher.Invoke(DispatcherPriority.Send,
|
||||
new Action(() =>
|
||||
{
|
||||
|
||||
UserControl.lblText.Content = $"Read {dic.GetIdent()}({done}/{total.Count})";
|
||||
}
|
||||
));
|
||||
if (dic.RegisterName.ToLower() != "password" && dic.RegisterDetail.Privilege.Lvl8 != Access.Wo)
|
||||
{
|
||||
Meter.ReadRegister(dic.GetIdent());
|
||||
}
|
||||
base.Progress = (Int32)Math.Round(((Double)done / (Double)total.Count) * 100, 0);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//todo: error logger
|
||||
}
|
||||
|
||||
done = done + 1;
|
||||
}
|
||||
|
||||
Meter.StoreCurrentRegisterDic();
|
||||
Meter._configuration.UseRegisterWatchService = oldConfigEntry;
|
||||
|
||||
currentProcessState = ProductionProcessState.Done;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
currentProcessState = ProductionProcessState.Error;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
using ProductionUiCordonel.ProductionProcesses.Enum;
|
||||
using ProductionUiCordonel.UserControls.FinalTest;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
||||
using Xylem.Common.Logic.ProductionOrderCore;
|
||||
using Xylem.Common.Logic.SoftwareAccessHelper;
|
||||
|
||||
namespace ProductionUiCordonel.ProductionProcesses.Actions
|
||||
{
|
||||
public class ProductionProcessGetFinalParameterizationVakoCsd : BaseProductionProcess
|
||||
{
|
||||
public IList<ProgrammingParameters> Result = new List<ProgrammingParameters>();
|
||||
private UcPlain UserControl;
|
||||
public ProductionProcessGetFinalParameterizationVakoCsd()
|
||||
{
|
||||
name = "Hole Kunden Parametrierung";
|
||||
currentProcessState = ProductionProcessState.Waiting;
|
||||
}
|
||||
public override void InitUserControl()
|
||||
{
|
||||
UserControl = new UcPlain();
|
||||
UserControl.lblHl.Content = name;
|
||||
UserControl.lblText.Content = "Kann bis zu 1 Minute dauern!";
|
||||
}
|
||||
|
||||
public override UserControl GetControl()
|
||||
{
|
||||
if (UserControl == null)
|
||||
{
|
||||
throw new Exception($"UserControl {this.GetType()} not Ready");
|
||||
}
|
||||
return UserControl;
|
||||
}
|
||||
|
||||
|
||||
public override void ProcessDone()
|
||||
{
|
||||
//clear
|
||||
}
|
||||
|
||||
|
||||
private void doStartProcessLoop()
|
||||
{
|
||||
var reTrysLeft = 2;
|
||||
while (reTrysLeft >= 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
base.Progress = 0;
|
||||
//var url = $"http://localhost:56011/api/FinalCheck/GetProgrammingParameters?PcbID={Meter.PcbId}";
|
||||
var url = $"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetProgrammingParameters?PcbID={Meter.PcbId}";
|
||||
var csdRet = LocalWebRequest.GetRequest(url, 60000);
|
||||
|
||||
Result = Newtonsoft.Json.JsonConvert.DeserializeObject<IList<ProgrammingParameters>>(csdRet);
|
||||
|
||||
base.Progress = 100;
|
||||
|
||||
if (!Result.Any())
|
||||
{
|
||||
base.currentProcessState = ProductionProcessState.Error;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentProcessState = ProductionProcessState.Done;
|
||||
return;
|
||||
}
|
||||
reTrysLeft = reTrysLeft - 1;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
base.currentProcessState = ProductionProcessState.Error;
|
||||
reTrysLeft = reTrysLeft - 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public override void StartProcess()
|
||||
{
|
||||
doStartProcessLoop();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
using Logic.ProductionToProductMapper.Cordonel;
|
||||
using ProductionUiCordonel.ProductionProcesses.Enum;
|
||||
using ProductionUiCordonel.UserControls.FinalTest;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Windows.Controls;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
using Xylem.Common.Logic.SoftwareAccessHelper;
|
||||
|
||||
namespace ProductionUiCordonel.ProductionProcesses.Actions
|
||||
{
|
||||
public class ProductionProcessLogOff : BaseProductionProcess
|
||||
{
|
||||
private UcPlain UserControl;
|
||||
public ProductionProcessLogOff()
|
||||
{
|
||||
name = "Log Off";
|
||||
currentProcessState = ProductionProcessState.Waiting;
|
||||
}
|
||||
public override void InitUserControl()
|
||||
{
|
||||
UserControl = new UcPlain();
|
||||
UserControl.lblHl.Content = name;
|
||||
UserControl.lblText.Content = "Abmelden um Einstellungen zu übernehmen";
|
||||
}
|
||||
|
||||
public override UserControl GetControl()
|
||||
{
|
||||
if (UserControl == null)
|
||||
{
|
||||
throw new Exception($"UserControl {this.GetType()} not Ready");
|
||||
}
|
||||
return UserControl;
|
||||
}
|
||||
|
||||
|
||||
public override void ProcessDone()
|
||||
{
|
||||
//clear
|
||||
}
|
||||
|
||||
public override void StartProcess()
|
||||
{
|
||||
|
||||
var apps = new List<CordonelAppVersion>();
|
||||
foreach (var item in Meter.MeterAppListVersion)
|
||||
{
|
||||
apps.Add(new CordonelAppVersion(item.AppId, item.StrVersion, (item.AppId != 15 ? true : false)));
|
||||
}
|
||||
|
||||
apps.Add(new CordonelAppVersion(-1, Meter.CoreRevision, false));
|
||||
|
||||
var url = $"{ServiceUrls.MeterProcessStateUrl()}SetCordonelProgress?PcbId={Meter.PcbId}&ProgressName=Shipping&version={Assembly.GetExecutingAssembly().GetName().Version.ToString()}";
|
||||
var a = LocalWebRequest.PostRequestAsync(url, json: apps);
|
||||
Meter.PushProgress("Shipping", Assembly.GetExecutingAssembly().GetName().Version.ToString());
|
||||
Meter.Logout();
|
||||
|
||||
currentProcessState = ProductionProcessState.Done;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
using Newtonsoft.Json;
|
||||
using ProductionUiCordonel.ProductionProcesses.Enum;
|
||||
using ProductionUiCordonel.UserControls.FinalTest;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Windows.Controls;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile;
|
||||
using Xylem.Common.Logic.SoftwareAccessHelper;
|
||||
|
||||
namespace ProductionUiCordonel.ProductionProcesses.Actions
|
||||
{
|
||||
public class ProductionProcessPasswordFile : BaseProductionProcess
|
||||
{
|
||||
private UcPasswordFile UserControl;
|
||||
|
||||
public ProductionProcessPasswordFile()
|
||||
{
|
||||
name = "PasswordFile";
|
||||
currentProcessState = ProductionProcessState.Waiting;
|
||||
}
|
||||
|
||||
public override void InitUserControl()
|
||||
{
|
||||
UserControl = new UcPasswordFile();
|
||||
}
|
||||
|
||||
public override UserControl GetControl()
|
||||
{
|
||||
if (UserControl == null)
|
||||
{
|
||||
throw new Exception($"UserControl {this.GetType()} not Ready");
|
||||
}
|
||||
return UserControl;
|
||||
}
|
||||
|
||||
private void updateImage(Image ctlImage, bool? success = null)
|
||||
{
|
||||
string path = "/Resources/iconWating.png";
|
||||
if (success.HasValue)
|
||||
{
|
||||
if (success.Value)
|
||||
{
|
||||
path = "/Resources/iconCheck.png";
|
||||
}
|
||||
else
|
||||
{
|
||||
path = "/Resources/iconWarn.png";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void StartProcess()
|
||||
{
|
||||
bool ret = RequestPassword();
|
||||
updateImage(UserControl.RequestPassword, ret);
|
||||
base.Progress = base.Progress + 16;
|
||||
|
||||
|
||||
if (Encoding.UTF8.GetString(pwContainer.listOfPasswords.Last()) == pwContainer.Skeleton)//pwContainer.Skeleton )
|
||||
{
|
||||
NewStatus("Passwörter schon geschrieben. Prozess wird übersprungen");
|
||||
base.currentProcessState = ProductionProcessState.Done;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (ret)
|
||||
{
|
||||
ret = CreatePasswordFile();
|
||||
}
|
||||
|
||||
|
||||
updateImage(UserControl.CreateFile, ret);
|
||||
base.Progress = base.Progress + 16;
|
||||
|
||||
if (ret)
|
||||
{
|
||||
ret = WritePasswordFileToMeter();
|
||||
}
|
||||
updateImage(UserControl.WriteToMeter, ret);
|
||||
base.Progress = base.Progress + 16;
|
||||
|
||||
if (ret)
|
||||
{
|
||||
ret = UpdatePasswordinDb();
|
||||
}
|
||||
updateImage(UserControl.UpdatePassword, ret);
|
||||
base.Progress = base.Progress + 16;
|
||||
|
||||
if (ret)
|
||||
{
|
||||
ret = Meter.Logout();
|
||||
}
|
||||
updateImage(UserControl.Logout, ret);
|
||||
base.Progress = base.Progress + 16;
|
||||
|
||||
|
||||
if (ret)
|
||||
{
|
||||
ret = Meter.Login();
|
||||
}
|
||||
updateImage(UserControl.CheckNewPassword, ret);
|
||||
base.Progress = 100;
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
base.currentProcessState = ProductionProcessState.Error;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.currentProcessState = ProductionProcessState.Done;
|
||||
}
|
||||
}
|
||||
public override void ProcessDone()
|
||||
{
|
||||
//clear
|
||||
}
|
||||
|
||||
#region realWork
|
||||
public class MeterPasswordContainer
|
||||
{
|
||||
public Int64? orderNumber = null;
|
||||
public Int64? radioAdress = null;
|
||||
public string Skeleton = "";
|
||||
public List<byte[]> listOfHashes = new List<byte[]>();
|
||||
public List<byte[]> listOfPasswords = new List<byte[]>();
|
||||
}
|
||||
|
||||
private MeterPasswordContainer pwContainer = new MeterPasswordContainer();
|
||||
private MeterPwdFile meterPwdFile;
|
||||
public bool RequestPassword()
|
||||
{
|
||||
base.NewStatus($"Request Passwords");
|
||||
var url = ServiceUrls.GenesisGetPasswordContainerServiceUrl();
|
||||
//url = "http://localhost:56011/api/Password/GetPasswordHashFileContent?PcbId=";
|
||||
url = ($"{url}{Meter.PcbId}");
|
||||
|
||||
var errorCode = 0;
|
||||
var header = new Dictionary<string, string>();
|
||||
header.Add("Cache-Control", "no-cache");
|
||||
header.Add("X-Node-Token", "d5b8c0b2-81f6-4421-80d0-44eb2093e616");
|
||||
var resp = LocalWebRequest.GetRequestWithError(url, out errorCode, 20000, header,true);
|
||||
if (errorCode == HttpStatusCode.OK.GetHashCode())
|
||||
{
|
||||
pwContainer = JsonConvert.DeserializeObject<MeterPasswordContainer>(resp);
|
||||
base.NewStatus($"Passwörter verfügbar");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public bool CreatePasswordFile()
|
||||
{
|
||||
|
||||
meterPwdFile = new MeterPwdFile(Meter);
|
||||
return meterPwdFile.BuildPwdFile(pwContainer.listOfPasswords, 1, pwContainer.Skeleton);
|
||||
}
|
||||
public bool WritePasswordFileToMeter()
|
||||
{
|
||||
if (meterPwdFile.UnlockEraseWriteMeterPwdFile())
|
||||
{
|
||||
return meterPwdFile.WriteMeterPwdFile();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public bool UpdatePasswordinDb()
|
||||
{
|
||||
|
||||
var newPs = Encoding.UTF8.GetString(pwContainer.listOfPasswords.Last());
|
||||
var passwordSetServiceUrl = ServiceUrls.GenesisSetPasswordServiceUrl();
|
||||
var http = (HttpWebRequest)WebRequest.Create(passwordSetServiceUrl + Meter.PcbId + "&Password=" + newPs + "&keepOldPw=true");
|
||||
var response = (HttpWebResponse)http.GetResponse();
|
||||
var responseStream = response.GetResponseStream();
|
||||
if (responseStream == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var sr = new StreamReader(responseStream);
|
||||
|
||||
var responseJson = sr.ReadToEnd();
|
||||
if (responseJson.ToLower().Contains("store"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,448 @@
|
||||
using ProductionUiCordonel.ProductionProcesses.Enum;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using ProductionUiCordonel.UserControls.FinalTest;
|
||||
using System.Threading;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
||||
using System.Net;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
using System.Configuration;
|
||||
using System.Net.Http;
|
||||
using System.Windows.Threading;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace ProductionUiCordonel.ProductionProcesses.Actions
|
||||
{
|
||||
public class ProductionProcessRadioCheck : BaseProductionProcess
|
||||
{
|
||||
private UcRadioCheck UserControl;
|
||||
public ProductionProcessRadioCheck()
|
||||
{
|
||||
|
||||
name = "Radio Check";
|
||||
currentProcessState = ProductionProcessState.Waiting;
|
||||
|
||||
|
||||
}
|
||||
public override void InitUserControl()
|
||||
{
|
||||
UserControl = new UcRadioCheck();
|
||||
|
||||
UserControl.OnRetryRequested += delegate (Object sender, EventArgs args) { GetRssi(); };
|
||||
|
||||
|
||||
UserControl.OnResetRequested += delegate (Object sender, EventArgs args) { Reset(); };
|
||||
UserControl.OnForceAPam += delegate (Object sender, EventArgs args) { forcePush(); };
|
||||
UserControl.OnDoneRequested += delegate (Object sender, EventArgs args)
|
||||
{
|
||||
currentProcessState = ProductionProcessState.Done;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
public override UserControl GetControl()
|
||||
{
|
||||
if (UserControl == null)
|
||||
{
|
||||
throw new Exception($"UserControl {this.GetType()} not Ready");
|
||||
}
|
||||
return UserControl;
|
||||
}
|
||||
|
||||
|
||||
public override void ProcessDone()
|
||||
{
|
||||
if (SENSUSRADIO_WakeupInterval != null)
|
||||
{
|
||||
var ret = Meter.WriteRegister("SENSUSRADIO_WakeupInterval", SENSUSRADIO_WakeupInterval,true,true);
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
base.currentProcessState = ProductionProcessState.Error;
|
||||
}
|
||||
}
|
||||
//clear
|
||||
}
|
||||
|
||||
private Byte[] SENSUSRADIO_WakeupInterval = null;
|
||||
public override void StartProcess()
|
||||
{
|
||||
|
||||
//readout adress, freq,
|
||||
//FrequencyIndicator
|
||||
var freq = RegisterConverter.ConvertTo<UInt32>(Meter.ReadRegister("SENSUSRADIO_FrequencyIndicator"));
|
||||
RadioAdress = RegisterConverter.ConvertTo<UInt32>(Meter.ReadRegister("SENSUSRADIO_RadioAddress"));
|
||||
var enc = Meter.ReadRegister("SENSUSRADIO_EncryptionKey",16);
|
||||
EncyptionKey = BitConverter.ToString(enc).Replace("-", "");
|
||||
|
||||
Comport = Convert.ToByte(ConfigurationManager.AppSettings[$"SirtComport{freq}"]);
|
||||
|
||||
//if (freq == 868)
|
||||
//{
|
||||
// Comport = 8;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Comport = 7;
|
||||
//}
|
||||
BoxNr = Convert.ToByte(ConfigurationManager.AppSettings[$"SirtBoxNr"]);
|
||||
|
||||
DebugMessage($"Start RadioCheck Comport:{Comport} ,BoxNr:{BoxNr}, freq: {freq}, RadioAdress:{RadioAdress}s\r\n", false);
|
||||
|
||||
Meter.WriteRegister("SENSUSRADIO_IrDAModulePresent", 1, true, true);
|
||||
|
||||
|
||||
SENSUSRADIO_WakeupInterval = Meter.ReadRegister("SENSUSRADIO_WakeupInterval");
|
||||
|
||||
|
||||
|
||||
GetRssi();
|
||||
}
|
||||
|
||||
#region FormerForm
|
||||
|
||||
private SaveData saveData;
|
||||
private SIRTCOM.Statemashine stm;
|
||||
private static HttpClient httpclient;
|
||||
|
||||
private byte? RSSI_PAM_Min;
|
||||
private byte? RSSI_PAM_Max;
|
||||
private byte? RSSI_PAM;
|
||||
private byte? RSSI_SEMI_Min;
|
||||
private byte? RSSI_SEMI_Max;
|
||||
private byte? RSSI_SEMI;
|
||||
|
||||
public byte BoxNr;
|
||||
|
||||
public int Ordernumber;
|
||||
public UInt32 RadioAdress;
|
||||
|
||||
public byte Comport;
|
||||
|
||||
public string EncyptionKey = "";
|
||||
|
||||
|
||||
private void enableBtn(Button btn, bool enable)
|
||||
{
|
||||
btn.Dispatcher.Invoke(DispatcherPriority.Send,
|
||||
new Action(() =>
|
||||
{
|
||||
btn.IsEnabled = enable;
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
private void SetUi()
|
||||
{
|
||||
UserControl.SetUi(new UcRadioCheck.UIContainer(RSSI_PAM_Min, RSSI_SEMI_Min, RSSI_PAM, RSSI_SEMI, RSSI_PAM_Max, RSSI_SEMI_Max));
|
||||
}
|
||||
|
||||
private async void GetRssi()
|
||||
{
|
||||
|
||||
//StartProcess();
|
||||
enableBtn(UserControl.btnGetRssi, false);
|
||||
|
||||
DebugMessage("");
|
||||
|
||||
|
||||
saveData = new SaveData();
|
||||
|
||||
SetUi();
|
||||
|
||||
|
||||
|
||||
//Meter.WriteRegister("SENSUSRADIO_PowerLevel", 67, true, true);
|
||||
//Meter.WriteRegister("SENSUSRADIO_PowerLevelOption", 59, true, true);
|
||||
//Meter.WriteRegister("SENSUSRADIO_ImpedanceCodeNew", 2992, true, true);
|
||||
//Meter.WriteRegister("SENSUSRADIO_ImpedanceCodeOption", 2936, true, true);
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
await GetRssiMinMaxAsync(BoxNr, Ordernumber);
|
||||
SetUi();
|
||||
GetRSSI((int)RadioAdress, Comport, EncyptionKey);
|
||||
SetUi();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
DebugMessage($"Fehler in buttonSende_Click():\r\n{ex.Message}\r\n{ex.InnerException}", true);
|
||||
}
|
||||
enableBtn(UserControl.btnGetRssi, true);
|
||||
}
|
||||
|
||||
private void clearRssi()
|
||||
{
|
||||
RSSI_PAM_Min = null;
|
||||
RSSI_PAM_Max = null;
|
||||
RSSI_PAM = null;
|
||||
RSSI_SEMI_Min = null;
|
||||
RSSI_SEMI_Max = null;
|
||||
RSSI_SEMI = null;
|
||||
}
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
if (!(stm == null))
|
||||
{
|
||||
stm.ClearPam();
|
||||
stm.Stop();
|
||||
}
|
||||
DebugMessage("Reset\r\n", false);
|
||||
clearRssi();
|
||||
SetUi();
|
||||
StartProcess();
|
||||
}
|
||||
|
||||
private class SaveData
|
||||
{
|
||||
public Int32 RadioAdress { get; set; }
|
||||
public byte RSSI_PAM { get; set; }
|
||||
public byte RSSI_SEMI { get; set; }
|
||||
public int LimitId { get; set; }
|
||||
public byte Result { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Speichert das gefüllte saveData Objekt via SaveRSSI Webservice
|
||||
/// </summary>
|
||||
private async void SaveDataToDB()
|
||||
{
|
||||
DebugMessage("Calling SaveRSSI Webservice...", true);
|
||||
try
|
||||
{
|
||||
saveData.RadioAdress = (int)RadioAdress; // 0-4294967295
|
||||
string url = $"{ServiceUrls.GenesisRadioCheckServiceUrl()}SaveRSSI";
|
||||
string body = JsonConvert.SerializeObject(saveData);
|
||||
await PostDataAsync(url, body);
|
||||
DebugMessage(" Ready\r\n", true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
DebugMessage($"Fehler in SaveDataToDB():\r\n{ex.Message}\r\n{ex.InnerException}", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private async Task GetRssiMinMaxAsync(byte BoxNr, Int32 FaNr)
|
||||
{
|
||||
//DebugMessage("Calling GetLimits Webservice...", true);
|
||||
try
|
||||
{
|
||||
// TODO anpassen
|
||||
string url = $"{ServiceUrls.GenesisRadioCheckServiceUrl()}GetLimits/{BoxNr}/{FaNr}";
|
||||
string body = await GetResponseAsync(url);
|
||||
JObject o = JObject.Parse(body);
|
||||
|
||||
saveData.LimitId = Convert.ToInt32(o.SelectToken("LimitId").ToString());
|
||||
RSSI_PAM_Min = Convert.ToByte(o.SelectToken("RSSI_PAM_Min").ToString());
|
||||
RSSI_PAM_Max = Convert.ToByte(o.SelectToken("RSSI_PAM_Max").ToString());
|
||||
RSSI_SEMI_Min = Convert.ToByte(o.SelectToken("RSSI_SEMI_Min").ToString());
|
||||
RSSI_SEMI_Max = Convert.ToByte(o.SelectToken("RSSI_SEMI_Max").ToString());
|
||||
DebugMessage(" Ready\r\n", true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
saveData.LimitId = 0;
|
||||
RSSI_PAM_Min = 120;
|
||||
|
||||
RSSI_PAM_Max = 163;
|
||||
RSSI_SEMI_Min = 150;
|
||||
RSSI_SEMI_Max = 182;
|
||||
// RSSI_PAM_Min RSSI_PAM_Max RSSI_SEMI_Min RSSI_SEMI_Max
|
||||
//145 164 182
|
||||
|
||||
throw new Exception("Fehler in GetRssiMinMax()", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void GetRSSI(Int32 RadioAdress, Int32 ByteCOMPort, string strKey)
|
||||
{
|
||||
|
||||
RSSI_PAM = null;
|
||||
RSSI_SEMI = null;
|
||||
|
||||
stm = new SIRTCOM.Statemashine();
|
||||
|
||||
byte P81_1 = 0;
|
||||
|
||||
saveData.RadioAdress = RadioAdress;
|
||||
|
||||
stm.initialise((byte)ByteCOMPort);
|
||||
SIRTCOM.Wrapper wrp = new SIRTCOM.Wrapper();
|
||||
stm.StartLoggin("C:\\GenesisLog\\log.txt");
|
||||
// ist wohl nicht nötig da der SIRT richtig konfiguroert ist:
|
||||
// wrp.ActivateSirt(byte modul1, byte modul2, byte actTimeout, out byte outP12_01, out byte outP12_02);
|
||||
|
||||
DebugMessage($"Sending PAM to {RadioAdress.ToString()} ...", true);
|
||||
stm.ClearPam();
|
||||
stm.Timeout_s = 60;
|
||||
|
||||
if (strKey == "")
|
||||
{
|
||||
// Dummy PAM 00 OHNE Funkschlüssel
|
||||
stm.SendPAM(RadioAdress.ToString(), "00", "", P81_1, 1, 0, "", "0", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Dummy PAM 00 mit Funkschlüssel
|
||||
stm.SendPAM(RadioAdress.ToString(), "00", "", P81_1, 1, 0, strKey, "0", true);
|
||||
}
|
||||
|
||||
stm.OnStateChanged += Stm_OnStateChanged;
|
||||
stm.Start(); // Start polling
|
||||
|
||||
DebugMessage($" OK\r\n", true);
|
||||
Meter.ResetAlarm(GenesisMeter.Alarm.EMPTY_PIPE);
|
||||
Thread.Sleep(5000);
|
||||
//Meter.WriteRegister("SENSUSRADIO_SYSTEMSTATE", 0x01, true, false);
|
||||
forcePush();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void forcePush()
|
||||
{
|
||||
Meter.WriteRegister("SENSUSRADIO_SYSTEMSTATE", 0x55, true, false);
|
||||
Meter.WriteRegister("SENSUSRADIO_SYSTEMSTATE", 0x02, true, false);
|
||||
}
|
||||
|
||||
|
||||
public void DebugMessage(string value, Boolean Append = false)
|
||||
{
|
||||
NewStatus(value);
|
||||
}
|
||||
|
||||
private void GotRSSICallback(byte Rssi_Semi_Sirt, byte Rssi_Pam_Cord)
|
||||
{
|
||||
// RSSI beim Empfangen der PAM gemessen vom Cordonel (Sendestärke des SIRT verpackt in SEMI, byte 20)
|
||||
DebugMessage($"RSSI Cord of PAM (Sirt => Cord):{Rssi_Pam_Cord}\r\n", true);
|
||||
RSSI_PAM = Rssi_Pam_Cord;
|
||||
RSSI_SEMI = Rssi_Semi_Sirt;
|
||||
|
||||
// RSSI beim Empfangen der SEMI gemessen vom SIRT (Sendestärke des Cordonel in byte 4)
|
||||
DebugMessage($"RSSI Sirt of SEMI (Cord => Sirt):{Rssi_Semi_Sirt}\r\n", true);
|
||||
saveData.RSSI_PAM = Rssi_Pam_Cord;
|
||||
saveData.RSSI_SEMI = Rssi_Semi_Sirt;
|
||||
|
||||
saveData.Result = 1;
|
||||
|
||||
if (RSSI_PAM < RSSI_PAM_Min)
|
||||
{
|
||||
saveData.Result = 0;
|
||||
}
|
||||
|
||||
if (RSSI_SEMI < RSSI_SEMI_Min)
|
||||
{
|
||||
saveData.Result = 0;
|
||||
}
|
||||
|
||||
if (RSSI_PAM > RSSI_PAM_Max)
|
||||
{
|
||||
saveData.Result = 0;
|
||||
}
|
||||
|
||||
if (RSSI_SEMI > RSSI_SEMI_Max)
|
||||
{
|
||||
saveData.Result = 0;
|
||||
}
|
||||
|
||||
|
||||
SaveDataToDB();
|
||||
SetUi();
|
||||
if (saveData.Result == 1)
|
||||
{
|
||||
UserControl.ViewResult(10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void Stm_OnStateChanged(object sender, SIRTCOM.MyEventArgs e)
|
||||
{
|
||||
// our Pam
|
||||
SIRTCOM.PAM Pam = stm.GetPAM(1);
|
||||
|
||||
if (Pam.State == SIRTCOM.PAM.PAMStates.Timeout)
|
||||
{
|
||||
DebugMessage($"Timeout nach {Pam.GetTime()} s\r\n", false);
|
||||
}
|
||||
|
||||
if (Pam.CountSemi > 0)
|
||||
{
|
||||
// we recieved the SEMI
|
||||
|
||||
//btnGetRssi.IsEnabled = true;
|
||||
stm.Stop();
|
||||
stm.ClearPam();
|
||||
|
||||
string HexbytesSEMI = Pam.Semi.HexData.Replace(" ", "");
|
||||
byte[] SEMI_bytes = new byte[HexbytesSEMI.Length / 2];
|
||||
|
||||
for (int i = 0; i < HexbytesSEMI.Length; i += 2)
|
||||
SEMI_bytes[i / 2] = Convert.ToByte(HexbytesSEMI.Substring(i, 2), 16);
|
||||
|
||||
// SEMI Status
|
||||
if (SEMI_bytes[19] == 0)
|
||||
{
|
||||
// RSSI beim Empfangen der SEMI gemessen vom Sirt
|
||||
byte Semi_Rssi_Sirt = SEMI_bytes[2];
|
||||
|
||||
// RSSI beim Empfangen der PAM gemessen vom Cordonel
|
||||
byte Pam_Rssi_Cord = SEMI_bytes[20];
|
||||
|
||||
GotRSSICallback(Semi_Rssi_Sirt, Pam_Rssi_Cord);
|
||||
}
|
||||
else
|
||||
{
|
||||
// SEMI Status ist nicht 0.
|
||||
DebugMessage(Pam.Semi.GetPamErrorMessage(), true);
|
||||
}
|
||||
stm.ClearPam();
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugMessage($"BUPS:{Pam.CountBup}\r\n", true);
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<string> PostDataAsync(string url, string data)
|
||||
{
|
||||
httpclient = new HttpClient();
|
||||
// 20 Sekunden Timeout
|
||||
httpclient.Timeout = new TimeSpan(0, 0, 20);
|
||||
|
||||
StringContent queryString = new StringContent(data, Encoding.UTF8, "application/json");
|
||||
HttpResponseMessage response = await httpclient.PostAsync(url, queryString);
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
string content = await response.Content.ReadAsStringAsync();
|
||||
return content;
|
||||
}
|
||||
|
||||
static async Task<string> GetResponseAsync(string url)
|
||||
{
|
||||
httpclient = new HttpClient();
|
||||
// 20 Sekunden Timeout
|
||||
httpclient.Timeout = new TimeSpan(0, 0, 20);
|
||||
|
||||
HttpResponseMessage response = httpclient.GetAsync(url).Result;
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
string content = await response.Content.ReadAsStringAsync();
|
||||
return content;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
using ProductionUiCordonel.ProductionProcesses.Enum;
|
||||
using ProductionUiCordonel.UserControls.FinalTest;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows.Controls;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||
|
||||
namespace ProductionUiCordonel.ProductionProcesses.Actions
|
||||
{
|
||||
public class ProductionProcessShippingMode : BaseProductionProcess
|
||||
{
|
||||
private UcPlain UserControl;
|
||||
public ProductionProcessShippingMode()
|
||||
{
|
||||
name = "Versandbereitschaft herstellen";
|
||||
currentProcessState = ProductionProcessState.Waiting;
|
||||
}
|
||||
public override void InitUserControl()
|
||||
{
|
||||
UserControl = new UcPlain();
|
||||
UserControl.lblHl.Content = name;
|
||||
UserControl.lblText.Content = "Display und Alarme für den Kunden einstellen.";
|
||||
}
|
||||
|
||||
public override UserControl GetControl()
|
||||
{
|
||||
if (UserControl == null)
|
||||
{
|
||||
throw new Exception($"UserControl {this.GetType()} not Ready");
|
||||
}
|
||||
return UserControl;
|
||||
}
|
||||
|
||||
|
||||
public override void ProcessDone()
|
||||
{
|
||||
//clear
|
||||
}
|
||||
|
||||
public override void StartProcess()
|
||||
{
|
||||
Meter.ResetAlarm(GenesisMeter.Alarm.ALL);//(true, new byte[] { 0x00, 0x00, 0x00, 0x01 });
|
||||
|
||||
Meter.SetLcdText(true, new byte[] { 0x00, 0x00, 0x00, 0x01 });
|
||||
|
||||
Meter.ResetAlarm(GenesisMeter.Alarm.EMPTY_PIPE);//(true, new byte[] { 0x00, 0x00, 0x00, 0x01 });
|
||||
|
||||
var useRadio = true;
|
||||
if (useRadio)
|
||||
{
|
||||
if (Meter.StoreAllApps())
|
||||
{
|
||||
|
||||
var writeList = new List<bool>();
|
||||
|
||||
writeList.Add(Meter.WriteRegister("SENSUSRADIO_SystemState", 1, true, false));
|
||||
writeList.Add(Meter.WriteRegister("SENSUSRADIO_MainAlarmMask", 0, true, false));
|
||||
writeList.Add(Meter.WriteRegister("SENSUSRADIO_ExtendedAlarmMask", 0, true, false));
|
||||
|
||||
|
||||
|
||||
writeList.Add(Meter.WriteRegister("SENSUSRADIO_SystemState", 0xFF, true, false));
|
||||
//Thread.Sleep(5000);
|
||||
Meter.Logout();
|
||||
Thread.Sleep(5000);
|
||||
Meter.Login();
|
||||
var radioResetSuccess = Meter.ReadRegister("SENSUSRADIO_SystemState");
|
||||
var SENSUSRADIO_MainAlarmMask = Meter.ReadRegister("SENSUSRADIO_MainAlarmMask");
|
||||
var SENSUSRADIO_ExtendedAlarmMask = Meter.ReadRegister("SENSUSRADIO_ExtendedAlarmMask");
|
||||
if (radioResetSuccess[0] == 0x02 && writeList.All(a => a == true) && SENSUSRADIO_MainAlarmMask[0] != 0)
|
||||
{
|
||||
base.currentProcessState = ProductionProcessState.Done;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.currentProcessState = ProductionProcessState.Error;
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Meter.StoreAllApps())
|
||||
{
|
||||
base.currentProcessState = ProductionProcessState.Done;
|
||||
return;
|
||||
}
|
||||
}
|
||||
base.currentProcessState = ProductionProcessState.Error;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
using ProductionUiCordonel.ProductionProcesses.Enum;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using ProductionUiCordonel.UserControls.FinalTest;
|
||||
using System.Threading;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
||||
|
||||
namespace ProductionUiCordonel.ProductionProcesses.Actions
|
||||
{
|
||||
public class ProductionProcessSpecialConfig : BaseProductionProcess
|
||||
{
|
||||
private UcDialog UserControl;
|
||||
|
||||
public bool DialogIsDone { get; private set; }
|
||||
|
||||
public ProductionProcessSpecialConfig()
|
||||
{
|
||||
DialogIsDone = false;
|
||||
name = "Customer Parameterization";
|
||||
currentProcessState = ProductionProcessState.Waiting;
|
||||
}
|
||||
public override void InitUserControl()
|
||||
{
|
||||
UserControl = new UcDialog();
|
||||
}
|
||||
|
||||
public override UserControl GetControl()
|
||||
{
|
||||
if (UserControl == null)
|
||||
{
|
||||
throw new Exception($"UserControl {this.GetType()} not Ready");
|
||||
}
|
||||
return UserControl;
|
||||
}
|
||||
|
||||
|
||||
public override void ProcessDone()
|
||||
{
|
||||
//clear
|
||||
}
|
||||
|
||||
private void StepDone()
|
||||
{
|
||||
base.currentProcessState = ProductionProcessState.Done;
|
||||
}
|
||||
|
||||
private void StepRadio()
|
||||
{
|
||||
|
||||
UserControl.SetDesc("Set EncryptionKey");
|
||||
var radioOptionList = new List<UcDialog.DialogOption>();
|
||||
var radioDefault = new UcDialog.DialogOption("old default", "same as iperl", () =>
|
||||
{
|
||||
|
||||
var funkadresse = new List<byte>();
|
||||
funkadresse.AddRange((new Byte[] { 0xE6, 0xC8, 0x88, 0x00 }).ToArray());
|
||||
funkadresse.AddRange((new Byte[] { 0xDE, 0xB8, 0x68, 0xC0 }).ToArray());
|
||||
funkadresse.AddRange((new Byte[] { 0xD6, 0xA8, 0x48, 0x80 }).ToArray());
|
||||
funkadresse.AddRange((new Byte[] { 0xCE, 0x98, 0x28, 0x40 }).ToArray());
|
||||
Meter.WriteRegister("SENSUSRADIO_EncryptionKey", funkadresse.ToArray(), true, true);
|
||||
StepDone();
|
||||
|
||||
});
|
||||
|
||||
var upRadioOnly = new UcDialog.DialogOption("alpha", "000...", () =>
|
||||
{
|
||||
Meter.WriteRegister("SENSUSRADIO_EncryptionKey", (new Byte[]
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
}).ToArray(), true, true);
|
||||
StepDone();
|
||||
|
||||
});
|
||||
|
||||
var optOneLiter = new UcDialog.DialogOption("new default", "new default key", () =>
|
||||
{
|
||||
var funkadresse = new List<byte>();
|
||||
funkadresse.AddRange((new Byte[] { 0x0E, 0x9F, 0xAC, 0xC6 }).ToArray());
|
||||
funkadresse.AddRange((new Byte[] { 0xA0, 0xE1, 0xEF, 0x1C }).ToArray());
|
||||
funkadresse.AddRange((new Byte[] { 0x3B, 0x27, 0xA4, 0x9B }).ToArray());
|
||||
funkadresse.AddRange((new Byte[] { 0xAC, 0x21, 0x65, 0x35 }).ToArray());
|
||||
Meter.WriteRegister("SENSUSRADIO_EncryptionKey", funkadresse.ToArray(), true, true);
|
||||
StepDone();
|
||||
});
|
||||
|
||||
radioOptionList.Add(radioDefault);
|
||||
radioOptionList.Add(upRadioOnly);
|
||||
radioOptionList.Add(optOneLiter);
|
||||
|
||||
UserControl.SetDialogOptions(radioOptionList);
|
||||
}
|
||||
private void StepWakeUp()
|
||||
{
|
||||
UserControl.SetDesc("Set Radio WakeUp");
|
||||
var wakeupOptionList = new List<UcDialog.DialogOption>();
|
||||
var wakeUpDefault = new UcDialog.DialogOption("wakeup Water and Radio", "Default for nearly all", () =>
|
||||
{
|
||||
Meter.WriteRegister("SENSUSRADIO_WakeupInterval", (new Byte[] { 0x00, 0x00, 0x00, 0x03 }).Reverse().ToArray(), true, true);
|
||||
StepRadio();
|
||||
});
|
||||
|
||||
var wakeUpRadioOnly = new UcDialog.DialogOption("wakeup only Radio", "WakeupInterval to 6 (only radio)", () =>
|
||||
{
|
||||
Meter.WriteRegister("SENSUSRADIO_WakeupInterval", (new Byte[] { 0x00, 0x00, 0x00, 0x06 }).Reverse().ToArray(), true, true);
|
||||
StepRadio();
|
||||
});
|
||||
|
||||
var pulseOptOneLiter = new UcDialog.DialogOption("wakeup off", "WakeupInterval to 0, no Radio active (e.g. USA))", () =>
|
||||
{
|
||||
Meter.WriteRegister("SENSUSRADIO_WakeupInterval", (new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true);
|
||||
StepRadio();
|
||||
});
|
||||
|
||||
wakeupOptionList.Add(wakeUpDefault);
|
||||
wakeupOptionList.Add(wakeUpRadioOnly);
|
||||
wakeupOptionList.Add(pulseOptOneLiter);
|
||||
|
||||
UserControl.SetDialogOptions(wakeupOptionList);
|
||||
}
|
||||
|
||||
private void StepPulse()
|
||||
{
|
||||
UserControl.SetDesc("Set Pulse Configuration");
|
||||
var pulseOptionList = new List<UcDialog.DialogOption>();
|
||||
var pulseOptOff = new UcDialog.DialogOption("Pulse off", "set pulsemode to off", () =>
|
||||
{
|
||||
Meter.WriteRegister("METROLOGYASST_PulseLength", (new Byte[] { 0x00, 0x00, 0x00, 0x07 }).Reverse().ToArray(), true, true);
|
||||
Meter.WriteRegister("METROLOGYASST_PulseMode", (new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true);
|
||||
Meter.WriteRegister("METROLOGYASST_PulseWeight", (new Byte[] { 0x00, 0x00, 0x27, 0x10 }).Reverse().ToArray(), true, true);
|
||||
StepWakeUp();
|
||||
});
|
||||
|
||||
var pulseOptDefault = new UcDialog.DialogOption("Pulse Default", "1 pulse per 10 l, pulse mode a4 and 200ms pulse length", () =>
|
||||
{
|
||||
Meter.WriteRegister("METROLOGYASST_PulseLength", (new Byte[] { 0x00, 0x00, 0x00, 0x07 }).Reverse().ToArray(), true, true);
|
||||
Meter.WriteRegister("METROLOGYASST_PulseMode", (new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, true);
|
||||
Meter.WriteRegister("METROLOGYASST_PulseWeight", (new Byte[] { 0x00, 0x00, 0x27, 0x10 }).Reverse().ToArray(), true, true);
|
||||
StepWakeUp();
|
||||
});
|
||||
|
||||
var pulseOptOneLiter = new UcDialog.DialogOption("One Liter Pulse", "1 pulse per 1l, pulse mode a4 and 20ms pulse length", () =>
|
||||
{
|
||||
Meter.WriteRegister("METROLOGYASST_PulseLength", (new Byte[] { 0x00, 0x00, 0x00, 0x04 }).Reverse().ToArray(), true, true);
|
||||
Meter.WriteRegister("METROLOGYASST_PulseMode", (new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, true);
|
||||
Meter.WriteRegister("METROLOGYASST_PulseWeight", (new Byte[] { 0x00, 0x00, 0x03, 0xE8 }).Reverse().ToArray(), true, true);
|
||||
StepWakeUp();
|
||||
});
|
||||
|
||||
pulseOptionList.Add(pulseOptOff);
|
||||
pulseOptionList.Add(pulseOptDefault);
|
||||
pulseOptionList.Add(pulseOptOneLiter);
|
||||
|
||||
UserControl.SetDialogOptions(pulseOptionList);
|
||||
}
|
||||
|
||||
public override async void StartProcess()
|
||||
{
|
||||
|
||||
StepPulse();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
using ProductionUiCordonel.ProductionProcesses.Enum;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||
|
||||
namespace ProductionUiCordonel.ProductionProcesses
|
||||
{
|
||||
public abstract class BaseProductionProcess : IProductionProcess
|
||||
{
|
||||
private int _progress = 0;
|
||||
public int Progress
|
||||
{
|
||||
get { return _progress; }
|
||||
set
|
||||
{
|
||||
_progress = value;
|
||||
PopUpProcessProgressChangedHandler?.Invoke(this, new PopUpProcessProgressArgs(_progress, PopUpProcessProgressArgs.ProcessProgessType.SubProcess));
|
||||
}
|
||||
}
|
||||
public ProductionProcessState currentProcessState;
|
||||
public string name;
|
||||
|
||||
public GenesisMeter Meter { get; internal set; }
|
||||
|
||||
public event EventHandler PopUpProcessStateChangedHandler;
|
||||
|
||||
public event EventHandler<PopUpProcessLogArgs> PopUpProcessLogHandler;
|
||||
public event EventHandler<PopUpProcessProgressArgs> PopUpProcessProgressChangedHandler;
|
||||
|
||||
StringBuilder sbLog = new StringBuilder();
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public ProductionProcessState GetState()
|
||||
{
|
||||
return currentProcessState;
|
||||
}
|
||||
|
||||
public UserControl GetUserControl()
|
||||
{
|
||||
return GetControl();
|
||||
}
|
||||
|
||||
public abstract UserControl GetControl();
|
||||
|
||||
public abstract void StartProcess();
|
||||
|
||||
public abstract void ProcessDone();
|
||||
public void Start(GenesisMeter meter, CancellationToken cancellationToken)
|
||||
{
|
||||
Meter = meter;
|
||||
currentProcessState = ProductionProcessState.Started;
|
||||
PopUpProcessStateChangedHandler?.Invoke(this, EventArgs.Empty);
|
||||
StartProcess();
|
||||
NewStatus($"Starte {name}");
|
||||
while (currentProcessState == ProductionProcessState.Started)
|
||||
{
|
||||
|
||||
Task.Delay(500);
|
||||
}
|
||||
|
||||
ProcessDone();
|
||||
NewStatus($"Prozess {name} is beendet (code:{currentProcessState.GetHashCode()})");
|
||||
PopUpProcessStateChangedHandler?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
}
|
||||
|
||||
internal void NewStatus(string v)
|
||||
{
|
||||
PopUpProcessLogHandler?.Invoke(this, new PopUpProcessLogArgs(v));
|
||||
sbLog.AppendLine(v);
|
||||
Meter.WriteLog($"{name} : {v}");
|
||||
}
|
||||
|
||||
public abstract void InitUserControl();
|
||||
public void Init()
|
||||
{
|
||||
InitUserControl();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProductionUiCordonel.ProductionProcesses.Enum
|
||||
{
|
||||
public enum ProductionProcessState
|
||||
{
|
||||
Waiting,
|
||||
Started,
|
||||
Done,
|
||||
Error
|
||||
}
|
||||
|
||||
public static class ProductionProcessStateHelper
|
||||
{
|
||||
public static string GetTextFromProductionProcessState(ProductionProcessState sate)
|
||||
{
|
||||
switch (sate)
|
||||
{
|
||||
case ProductionProcessState.Waiting:
|
||||
return "Warte";
|
||||
case ProductionProcessState.Started:
|
||||
return "Läuft";
|
||||
case ProductionProcessState.Done:
|
||||
return "Fertig";
|
||||
default:
|
||||
return "Fehler";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using ProductionUiCordonel.ProductionProcesses.Enum;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||
|
||||
namespace ProductionUiCordonel.ProductionProcesses
|
||||
{
|
||||
public interface IProductionProcess
|
||||
{
|
||||
event EventHandler PopUpProcessStateChangedHandler;
|
||||
|
||||
event EventHandler<PopUpProcessProgressArgs> PopUpProcessProgressChangedHandler;
|
||||
|
||||
event EventHandler<PopUpProcessLogArgs> PopUpProcessLogHandler;
|
||||
string GetName();
|
||||
ProductionProcessState GetState();
|
||||
UserControl GetUserControl();
|
||||
void Start(GenesisMeter Meter,CancellationToken cancellationToken);
|
||||
void Init();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
using ProductionUiCordonel.ProductionProcesses.Actions;
|
||||
using ProductionUiCordonel.ProductionProcesses.Enum;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||
|
||||
namespace ProductionUiCordonel.ProductionProcesses
|
||||
{
|
||||
public class MultiProcessController
|
||||
{
|
||||
public List<IProductionProcess> Processes;
|
||||
public event EventHandler ProcessStateChangedHandler;
|
||||
public event EventHandler<PopUpProcessLogArgs> ProcessLogHandler;
|
||||
public event EventHandler<PopUpProcessProgressArgs> ProcessProgressHandler;
|
||||
|
||||
private CancellationTokenSource canncelToken = new CancellationTokenSource();
|
||||
|
||||
public IProductionProcess ErrorProcess { get; internal set; }
|
||||
public IProductionProcess DoneProcess { get; internal set; }
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
canncelToken.Cancel();
|
||||
}
|
||||
|
||||
internal void InitUserControl()
|
||||
{
|
||||
Processes.ForEach(a => a.Init());
|
||||
}
|
||||
|
||||
internal void Start(GenesisMeter meter)
|
||||
{
|
||||
Processes.ForEach(f=> f.Init());
|
||||
DoneProcess.Init();
|
||||
ErrorProcess.Init();
|
||||
var t = new Task(() =>
|
||||
{
|
||||
while (Processes.Any(cp => cp.GetState() == ProductionProcessState.Waiting) && !Processes.Any(cp => cp.GetState() == ProductionProcessState.Error))
|
||||
{
|
||||
var process = Processes.First(cp => cp.GetState() == ProductionProcessState.Waiting);
|
||||
AddProccessEvents(process);
|
||||
process.Start(meter,canncelToken.Token);
|
||||
RemoveProccessEvents(process);
|
||||
CalcAndPushOverAllProcess();
|
||||
}
|
||||
|
||||
var showLastStep = DoneProcess;
|
||||
if (Processes.Any(cp => cp.GetState() == ProductionProcessState.Error))
|
||||
{
|
||||
showLastStep = ErrorProcess;
|
||||
}
|
||||
|
||||
|
||||
AddProccessEvents(showLastStep);
|
||||
showLastStep.Start(meter, canncelToken.Token);
|
||||
RemoveProccessEvents(showLastStep);
|
||||
CalcAndPushOverAllProcess();
|
||||
});
|
||||
|
||||
t.Start();
|
||||
|
||||
}
|
||||
|
||||
void CalcAndPushOverAllProcess()
|
||||
{
|
||||
|
||||
var Total = Processes.Count;
|
||||
var Done = Processes.Where(w => w.GetState() == ProductionProcessState.Done).Count();
|
||||
var progress = 0;
|
||||
if (Done > 0)
|
||||
{
|
||||
progress = (100 / Total) * Done;
|
||||
}
|
||||
ProcessProgressHandler?.Invoke(this, new PopUpProcessProgressArgs(progress, PopUpProcessProgressArgs.ProcessProgessType.Total ));
|
||||
}
|
||||
|
||||
private void AddProccessEvents(IProductionProcess process)
|
||||
{
|
||||
process.PopUpProcessProgressChangedHandler += Process_PopUpProcessProgressChangedHandler;
|
||||
process.PopUpProcessLogHandler += Process_PopUpProcessLogHandler;
|
||||
process.PopUpProcessStateChangedHandler += ProcessOnPopUpProcessStateChangedHandler;
|
||||
}
|
||||
private void RemoveProccessEvents(IProductionProcess process)
|
||||
{
|
||||
process.PopUpProcessProgressChangedHandler -= Process_PopUpProcessProgressChangedHandler;
|
||||
process.PopUpProcessLogHandler -= Process_PopUpProcessLogHandler;
|
||||
process.PopUpProcessStateChangedHandler -= ProcessOnPopUpProcessStateChangedHandler;
|
||||
}
|
||||
|
||||
|
||||
private void Process_PopUpProcessProgressChangedHandler(object sender, PopUpProcessProgressArgs e)
|
||||
{
|
||||
ProcessProgressHandler?.Invoke(sender,e);
|
||||
}
|
||||
|
||||
private void Process_PopUpProcessLogHandler(object sender, PopUpProcessLogArgs e)
|
||||
{
|
||||
ProcessLogHandler?.Invoke(sender,e);
|
||||
}
|
||||
|
||||
private void ProcessOnPopUpProcessStateChangedHandler(Object sender, EventArgs e)
|
||||
{
|
||||
ProcessStateChangedHandler?.Invoke(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProductionUiCordonel.ProductionProcesses
|
||||
{
|
||||
public class PopUpProcessLogArgs : EventArgs
|
||||
{
|
||||
public readonly string Data;
|
||||
public PopUpProcessLogArgs(string text)
|
||||
{
|
||||
Data = text;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProductionUiCordonel.ProductionProcesses
|
||||
{
|
||||
public class PopUpProcessProgressArgs : EventArgs
|
||||
{
|
||||
public enum ProcessProgessType
|
||||
{
|
||||
Total,
|
||||
SubProcess,
|
||||
}
|
||||
public readonly ProcessProgessType ProgressType;
|
||||
public readonly int Progress;
|
||||
public PopUpProcessProgressArgs(int progress, ProcessProgessType type)
|
||||
{
|
||||
Progress = progress;
|
||||
ProgressType = type;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProductionUiCordonel.ProductionProcesses
|
||||
{
|
||||
public class ProcessStateChangedArgs : EventArgs
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,379 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{D72BFC81-AA50-45F2-9FB2-DF4F373F6AD4}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ProductionUiCordonel</RootNamespace>
|
||||
<AssemblyName>ProductionUiCordonel</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<PublishUrl>C:\Users\drabesch_ro\Documents\cordonelProduction\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<AutorunEnabled>true</AutorunEnabled>
|
||||
<ApplicationRevision>1</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<LangVersion>7.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<LangVersion>7.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestCertificateThumbprint>B5ADA7D4C91EA2D22928C5D42E39A4BAD8EDBABB</ManifestCertificateThumbprint>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestKeyFile>ProductionUiCordonel_TemporaryKey.pfx</ManifestKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateManifests>true</GenerateManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignManifests>false</SignManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>ProductionUiCordonel.App</StartupObject>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Hardware\WaterMeter\Genesis\GenesisConfig\bin\Debug\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SIRTCOM">
|
||||
<HintPath>.\SIRTCOM.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<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="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="MultiMode.xaml.cs">
|
||||
<DependentUpon>MultiMode.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MultiModeChild.xaml.cs">
|
||||
<DependentUpon>MultiModeChild.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\IMultiModeChildViewModel.cs" />
|
||||
<Compile Include="ProductionProcesses\Actions\ProductionProcessCheckSerialNumber.cs" />
|
||||
<Compile Include="ProductionProcesses\Actions\ProductionProcessCheckOrderNumber.cs" />
|
||||
<Compile Include="ProductionProcesses\Actions\ProductionProcessCheckAttachment.cs" />
|
||||
<Compile Include="ProductionProcesses\Actions\ProductionProcessGetFinalParameterizationVakoCsd.cs" />
|
||||
<Compile Include="ProductionProcesses\Actions\ProductionProcessFinalParameterizationVakoCsd.cs" />
|
||||
<Compile Include="ProductionProcesses\Actions\ProductionProcessLogOff.cs" />
|
||||
<Compile Include="ProductionProcesses\Actions\ProductionProcessShippingMode.cs" />
|
||||
<Compile Include="ProductionProcesses\Actions\ProductionProcessRadioCheck.cs" />
|
||||
<Compile Include="ProductionProcesses\Actions\ProductionProcessDone.cs" />
|
||||
<Compile Include="ProductionProcesses\Actions\ProductionProcessSpecialConfig.cs" />
|
||||
<Compile Include="ProductionProcesses\Actions\ProductionProcessFinalParameterizationFix.cs" />
|
||||
<Compile Include="ProductionProcesses\Actions\ProductionProcessFullReadOut.cs" />
|
||||
<Compile Include="ProductionProcesses\Actions\ProductionProcessConnect.cs" />
|
||||
<Compile Include="ProductionProcesses\Actions\ProductionProcessPasswordFile.cs" />
|
||||
<Compile Include="ProductionProcesses\BaseProductionProcess.cs" />
|
||||
<Compile Include="ProductionProcesses\Enum\ProductionProcessState.cs" />
|
||||
<Compile Include="ProductionProcesses\IProductionProcess.cs" />
|
||||
<Compile Include="ProductionProcesses\MultiProcessController.cs" />
|
||||
<Compile Include="ProductionProcesses\PopUpProcessLogArgs.cs" />
|
||||
<Compile Include="ProductionProcesses\PopUpProcessProgressArgs.cs" />
|
||||
<Compile Include="ProductionProcesses\ProcessStateChangedArgs.cs" />
|
||||
<Compile Include="UserControls\FinalTest\UcBarcodeInput.xaml.cs">
|
||||
<DependentUpon>UcBarcodeInput.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserControls\FinalTest\UcFullReadOut.xaml.cs">
|
||||
<DependentUpon>UcFullReadOut.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserControls\FinalTest\UcDialog.xaml.cs">
|
||||
<DependentUpon>UcDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserControls\FinalTest\UcRadioCheck.xaml.cs">
|
||||
<DependentUpon>UcRadioCheck.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserControls\FinalTest\UcPlain.xaml.cs">
|
||||
<DependentUpon>UcPlain.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserControls\FinalTest\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="FinalTest.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FinalTest.xaml.cs">
|
||||
<DependentUpon>FinalTest.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="MultiMode.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="MultiModeChild.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UserControls\FinalTest\UcBarcodeInput.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="UserControls\FinalTest\UcFullReadOut.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UserControls\FinalTest\UcDialog.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="UserControls\FinalTest\UcRadioCheck.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="UserControls\FinalTest\UcPlain.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UserControls\FinalTest\UcPasswordFile.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="packages.config" />
|
||||
<None Include="ProductionUiCordonel_TemporaryKey.pfx" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<AppDesigner Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CommonCore.Configuration\CommonCore.Configuration.csproj">
|
||||
<Project>{9EB1F659-6F73-4F65-BCAB-4114FD94F5FC}</Project>
|
||||
<Name>CommonCore.Configuration</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\CommonCore\CommonCore.csproj">
|
||||
<Project>{1B02C79E-0B19-43E2-8F6B-71EF0C786C97}</Project>
|
||||
<Name>CommonCore</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Hardware\WaterMeter\Genesis\Applications\Applications.csproj">
|
||||
<Project>{315E94B8-B82F-4B25-B5BD-297DF3BC1D54}</Project>
|
||||
<Name>Applications</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Hardware\WaterMeter\Genesis\DataPackages\DataPackages.csproj">
|
||||
<Project>{0E524D43-7B66-45CD-AA74-41D51AFC3D99}</Project>
|
||||
<Name>DataPackages</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Hardware\WaterMeter\Genesis\GenesisConfig\GenesisConfig.csproj">
|
||||
<Project>{F013A56B-7BE6-4852-9CD8-B971CD1ADD0C}</Project>
|
||||
<Name>GenesisConfig</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Hardware\WaterMeter\Genesis\GenesisCore\GenesisCore.csproj">
|
||||
<Project>{04201E95-90A0-4B73-A72F-379739B2A3AE}</Project>
|
||||
<Name>GenesisCore</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Hardware\WaterMeter\Genesis\GenesisFile\GenesisFile.csproj">
|
||||
<Project>{2C6378C6-6BA1-4CEE-8992-8404D8369A90}</Project>
|
||||
<Name>GenesisFile</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Hardware\WaterMeter\Genesis\Registers\Registers.csproj">
|
||||
<Project>{F4AAF7E6-7333-4284-B735-E32DEB076C64}</Project>
|
||||
<Name>Registers</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Hardware\WaterMeter\WaterMeterCore\WaterMeterCore.csproj">
|
||||
<Project>{8203ABB8-38E5-472E-A742-33F38B7A74A6}</Project>
|
||||
<Name>WaterMeterCore</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Hardware\WaterMeter\WaterMeterCore\WaterMeterRegisters\WaterMeterRegisters.csproj">
|
||||
<Project>{26AFCF1E-1287-48B8-A506-32B1E8A0DD0E}</Project>
|
||||
<Name>WaterMeterRegisters</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Logic.PrdoctionToProductMapper\Logic.ProductionToProductMapper.csproj">
|
||||
<Project>{D0C859D9-D55E-4E85-AC50-0FF31B1CE50D}</Project>
|
||||
<Name>Logic.ProductionToProductMapper</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Logic\ProductionOrderCore\ProductionOrderCore.csproj">
|
||||
<Project>{6D2777BB-7A88-466D-A49B-3266F9BF0160}</Project>
|
||||
<Name>ProductionOrderCore</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SoftwareAccessHelper\SoftwareAccessHelper.csproj">
|
||||
<Project>{A33E3C6D-EAAE-4A20-A0EE-F9E6922FD029}</Project>
|
||||
<Name>SoftwareAccessHelper</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Utils\Logging\Logging.csproj">
|
||||
<Project>{4B88B0D3-E791-4774-9521-EABEACDC420E}</Project>
|
||||
<Name>Logging</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\iconCheck.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\iconWarn.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\iconWating.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.6">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.6 %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\Refresh_16x.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Resources\Connect_16x.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Resources\ConnectPlugged_16x.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<None Include="Resources\ClearMatrix.bmp" />
|
||||
<None Include="Resources\CLEARMAtrix.JPG">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<Content Include="SIRT_Driver_Win32_PC.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,53 @@
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ProductionUiCordonel")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ProductionUiCordonel")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//In order to begin building localizable applications, set
|
||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||
//inside a <PropertyGroup>. For example, if you are using US english
|
||||
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||
//the line below to match the UICulture setting in the project file.
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
@@ -0,0 +1,133 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ProductionUiCordonel.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProductionUiCordonel.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap CLEARMAtrix {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("CLEARMAtrix", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Connect_16x {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Connect_16x", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap ConnectPlugged_16x {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("ConnectPlugged_16x", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap iconCheck {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("iconCheck", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap iconWarn {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("iconWarn", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap iconWating {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("iconWating", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Refresh_16x {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Refresh_16x", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="ConnectPlugged_16x" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ConnectPlugged_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Connect_16x" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Connect_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="iconCheck" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\iconCheck.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="iconWarn" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\iconWarn.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="iconWating" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\iconWating.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Refresh_16x" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Refresh_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="CLEARMAtrix" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\CLEARMAtrix.JPG;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ProductionUiCordonel.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
|
After Width: | Height: | Size: 9.8 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 542 B |
|
After Width: | Height: | Size: 329 B |
|
After Width: | Height: | Size: 591 B |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
@@ -0,0 +1,14 @@
|
||||
<UserControl x:Class="ProductionUiCordonel.UserControls.FinalTest.UcBarcodeInput"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ProductionUiCordonel.UserControls.FinalTest"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="260" d:DesignWidth="350" MouseDown="UserControl_MouseDown">
|
||||
<Grid>
|
||||
<Label Content="" HorizontalAlignment="Left" Height="25" VerticalAlignment="Top" Width="136" Margin="10,0,0,0"/>
|
||||
<Label Name="lblDescription" Content="" Margin="10,30,10,10"/>
|
||||
<TextBox Name="txtHiddenInput" Height="0" Width="0" KeyDown="txtHiddenInput_KeyDown" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,107 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace ProductionUiCordonel.UserControls.FinalTest
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for UcDialog.xaml
|
||||
/// </summary>
|
||||
public partial class UcBarcodeInput : UserControl
|
||||
{
|
||||
|
||||
public event EventHandler<KeyEventArgs> BarcodeInput;
|
||||
|
||||
public UcBarcodeInput()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public class DialogOption
|
||||
{
|
||||
public DialogOption(string headLine, string desc, Action selectedAction)
|
||||
{
|
||||
HeadLine = headLine;
|
||||
Desc = desc;
|
||||
SelectedAction = selectedAction;
|
||||
}
|
||||
private Action SelectedAction;
|
||||
private string HeadLine = "Hl";
|
||||
private string Desc = "descr";
|
||||
public UIElement GeneratBtn()
|
||||
{
|
||||
var btn = new Button();
|
||||
btn.Content = HeadLine;
|
||||
btn.Click += (sender, args) => { SelectedAction.Invoke(); };
|
||||
|
||||
return btn;
|
||||
|
||||
}
|
||||
|
||||
public UIElement GeneratInfo()
|
||||
{
|
||||
var lbl = new Label();
|
||||
lbl.Content = Desc;
|
||||
lbl.Width = 800;
|
||||
return lbl;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal void SetDesc(string v)
|
||||
{
|
||||
lblDescription.Dispatcher.Invoke(DispatcherPriority.Send,
|
||||
new Action(() =>
|
||||
{
|
||||
|
||||
lblDescription.Content = v;
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
internal void SetFocusMe()
|
||||
{
|
||||
this.Dispatcher.Invoke(DispatcherPriority.Send,
|
||||
new Action(() =>
|
||||
{
|
||||
txtHiddenInput.Focus();
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
private void txtHiddenInput_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
|
||||
BarcodeInput?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void UserControl_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
this.Dispatcher.Invoke(DispatcherPriority.Send,
|
||||
new Action(() =>
|
||||
{
|
||||
txtHiddenInput.Focus();
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<UserControl x:Class="ProductionUiCordonel.UserControls.FinalTest.UcDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ProductionUiCordonel.UserControls.FinalTest"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="260" Width="453.058">
|
||||
<Grid Margin="0,0,10,0">
|
||||
<Label Content="" HorizontalAlignment="Left" Height="25" VerticalAlignment="Top" Width="136" Margin="10,0,0,0"/>
|
||||
<Label Name="lblDescription" Content="" HorizontalAlignment="Left" Height="25" VerticalAlignment="Top" Width="136" Margin="10,30,0,0"/>
|
||||
<StackPanel Name="PanelSelection" Margin="23,70,0,0" HorizontalAlignment="Left" Width="380" Height="155" VerticalAlignment="Top"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,105 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace ProductionUiCordonel.UserControls.FinalTest
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for UcDialog.xaml
|
||||
/// </summary>
|
||||
public partial class UcDialog : UserControl
|
||||
{
|
||||
public UcDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public class DialogOption
|
||||
{
|
||||
public DialogOption(string headLine, string desc, Action selectedAction)
|
||||
{
|
||||
HeadLine = headLine;
|
||||
Desc = desc;
|
||||
SelectedAction = selectedAction;
|
||||
}
|
||||
private Action SelectedAction;
|
||||
private string HeadLine = "Hl";
|
||||
private string Desc = "descr";
|
||||
public UIElement GeneratBtn()
|
||||
{
|
||||
var btn = new Button();
|
||||
btn.Content = HeadLine;
|
||||
btn.Click += (sender, args) => { SelectedAction.Invoke(); };
|
||||
|
||||
return btn;
|
||||
|
||||
}
|
||||
|
||||
public UIElement GeneratInfo()
|
||||
{
|
||||
var lbl = new Label();
|
||||
lbl.Content = Desc;
|
||||
lbl.Width = 800;
|
||||
return lbl;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal void SetDesc(string v)
|
||||
{
|
||||
lblDescription.Dispatcher.Invoke(DispatcherPriority.Send,
|
||||
new Action(() =>
|
||||
{
|
||||
|
||||
lblDescription.Content = v;
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
public void SetDialogOptions(List<DialogOption> optList)
|
||||
{
|
||||
|
||||
PanelSelection.Dispatcher.Invoke(DispatcherPriority.Send,
|
||||
new Action(() =>
|
||||
{
|
||||
|
||||
PanelSelection.Children.Clear();
|
||||
}
|
||||
));
|
||||
|
||||
foreach (var opt in optList)
|
||||
{
|
||||
|
||||
|
||||
|
||||
this.Dispatcher.Invoke(DispatcherPriority.Send,
|
||||
new Action(() =>
|
||||
{
|
||||
var stackPnl = new StackPanel();
|
||||
stackPnl.Orientation = Orientation.Horizontal;
|
||||
stackPnl.Children.Add(opt.GeneratBtn());
|
||||
stackPnl.Children.Add(opt.GeneratInfo());
|
||||
PanelSelection.Children.Add(stackPnl);
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<UserControl x:Class="ProductionUiCordonel.UserControls.FinalTest.UcFullReadOut"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ProductionUiCordonel.UserControls.FinalTest"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<Grid>
|
||||
<Label Content="ReadOut" HorizontalAlignment="Left" Height="30" VerticalAlignment="Top" Width="83"/>
|
||||
<Label Name="lblHl" HorizontalAlignment="Left" Height="27" Margin="0,106,0,0" VerticalAlignment="Top" Width="300" FontSize="6"/>
|
||||
<Label Name="lblText" HorizontalAlignment="Left" Height="27" Margin="1,138,0,0" VerticalAlignment="Top" Width="299" FontSize="6"/>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace ProductionUiCordonel.UserControls.FinalTest
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for FullReadOut.xaml
|
||||
/// </summary>
|
||||
public partial class UcFullReadOut : UserControl
|
||||
{
|
||||
public UcFullReadOut()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<UserControl x:Class="ProductionUiCordonel.UserControls.FinalTest.UcPasswordFile"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ProductionUiCordonel.UserControls.FinalTest"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="150" d:DesignWidth="250" Background="Bisque">
|
||||
<Grid Margin="0,0,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="161"/>
|
||||
<ColumnDefinition Width="47"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40*"/>
|
||||
<RowDefinition Height="40*"/>
|
||||
<RowDefinition Height="40*"/>
|
||||
<RowDefinition Height="40*"/>
|
||||
<RowDefinition Height="40*"/>
|
||||
<RowDefinition Height="40*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Label Content="Passwörter anfordern" HorizontalAlignment="Left" Height="24" VerticalAlignment="Top" Width="140" Margin="10,0,0,0" Grid.Row="0" Grid.Column="0" />
|
||||
<Label Content="Datei erstellen" HorizontalAlignment="Left" Height="24" VerticalAlignment="Top" Width="113" Margin="10,0,0,0" Grid.Row="1" Grid.Column="0" />
|
||||
<Label Content="Datei übertragen" HorizontalAlignment="Left" Height="24" VerticalAlignment="Top" Width="113" Margin="10,0,0,0" Grid.Row="2" Grid.Column="0" />
|
||||
<Label Content="Passwort erneuern" HorizontalAlignment="Left" Height="24" VerticalAlignment="Top" Width="118" Margin="10,0,0,0" Grid.Row="3" Grid.Column="0" />
|
||||
<Label Content="Abmelden" HorizontalAlignment="Left" Height="24" VerticalAlignment="Top" Width="113" Margin="10,0,0,0" Grid.Row="4" Grid.Column="0" />
|
||||
<Label Content="Anmelden überprüfen" HorizontalAlignment="Left" Height="24" VerticalAlignment="Top" Width="128" Margin="10,0,0,0" Grid.Row="5" Grid.Column="0" />
|
||||
|
||||
<Image Name="RequestPassword" Grid.Row="0" HorizontalAlignment="Center" Width="40" Source="/Resources/iconWating.png" Margin="150,0,18,0" Grid.ColumnSpan="2" />
|
||||
<Image Name="CreateFile" Grid.Row="1" HorizontalAlignment="Center" Width="40" Source="/Resources/iconWating.png" Margin="150,0,18,0" Grid.ColumnSpan="2" />
|
||||
<Image Name="WriteToMeter" Grid.Row="2" HorizontalAlignment="Center" Width="40" Source="/Resources/iconWating.png" Margin="150,0,18,0" Grid.ColumnSpan="2" />
|
||||
<Image Name="UpdatePassword" Grid.Row="3" HorizontalAlignment="Center" Width="40" Source="/Resources/iconWating.png" Margin="150,0,18,0" Grid.ColumnSpan="2" />
|
||||
<Image Name="Logout" Grid.Row="4" HorizontalAlignment="Center" Width="40" Source="/Resources/iconWating.png" Margin="150,0,18,0" Grid.ColumnSpan="2" />
|
||||
<Image Name="CheckNewPassword" Grid.Row="5" HorizontalAlignment="Center" Width="40" Source="/Resources/iconWating.png" Margin="150,0,18,0" Grid.ColumnSpan="2" />
|
||||
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace ProductionUiCordonel.UserControls.FinalTest
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for UcPasswordFile.xaml
|
||||
/// </summary>
|
||||
public partial class UcPasswordFile : UserControl
|
||||
{
|
||||
public UcPasswordFile()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<UserControl x:Class="ProductionUiCordonel.UserControls.FinalTest.UcPlain"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ProductionUiCordonel.UserControls.FinalTest"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="260" d:DesignWidth="350">
|
||||
<Grid>
|
||||
<Label Name="lblHl" Content="ReadOut" HorizontalAlignment="Left" Height="60" VerticalAlignment="Top" Width="340" FontSize="10"/>
|
||||
<Label Name="lblText" HorizontalAlignment="Left" Height="56" Margin="1,109,0,0" VerticalAlignment="Top" Width="339" FontSize="8"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace ProductionUiCordonel.UserControls.FinalTest
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for UcPlain.xaml
|
||||
/// </summary>
|
||||
public partial class UcPlain : UserControl
|
||||
{
|
||||
public UcPlain()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<UserControl x:Class="ProductionUiCordonel.UserControls.FinalTest.UcRadioCheck"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ProductionUiCordonel.UserControls.FinalTest"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="150" d:DesignWidth="300" Background="Aquamarine">
|
||||
<Grid Margin="0,0,0,0" HorizontalAlignment="Left" Width="300">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="120px"/>
|
||||
<ColumnDefinition Width="50px"/>
|
||||
<ColumnDefinition Width="50px"/>
|
||||
<ColumnDefinition Width="50px"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40*"/>
|
||||
<RowDefinition Height="40*"/>
|
||||
<RowDefinition Height="40*"/>
|
||||
<RowDefinition Height="40*"/>
|
||||
<RowDefinition Height="40*"/>
|
||||
<RowDefinition Height="40*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Button Name="btnGetRssi" Content="Get RSSI" Click="Button_Click" HorizontalAlignment="Left" Width="66" Grid.Row="5" Grid.ColumnSpan="2" Margin="105,0,0,0"/>
|
||||
<Button Name="btnReset" Content="Reset" Grid.Column="3" HorizontalAlignment="Left" Height="25" VerticalAlignment="Top" Width="50" Click="btnReset_Click" Grid.Row="5" Margin="27,0,-26,0"/>
|
||||
<Label Content="Radio Check" HorizontalAlignment="Left" Height="30" Margin="10,0,0,0" Grid.RowSpan="2" VerticalAlignment="Top" Width="86" Grid.ColumnSpan="2"/>
|
||||
|
||||
<Label Content="" HorizontalAlignment="Left" Height="25" Margin="0,0,0,0" Grid.Row="1" Grid.Column="0" VerticalAlignment="Top" Width="68"/>
|
||||
<Label Content="RSSI PAM=>Cord" HorizontalAlignment="Left" Height="25" Margin="0,0,0,0" Grid.Row="2" Grid.Column="0" VerticalAlignment="Top" Width="105" Grid.ColumnSpan="2"/>
|
||||
<Label Content="RSSI SEMI=>SIRT" HorizontalAlignment="Left" Height="25" Margin="0,0,0,0" Grid.Row="3" Grid.Column="0" VerticalAlignment="Top" Width="105" Grid.ColumnSpan="2"/>
|
||||
|
||||
|
||||
<Label Content="Min" HorizontalAlignment="Left" Height="25" Margin="0,0,0,0" Grid.Row="1" Grid.Column="1" VerticalAlignment="Top" Width="50"/>
|
||||
<Label Name="lblCordMin" Content="-" HorizontalAlignment="Left" Height="25" Margin="0,0,0,0" Grid.Row="2" Grid.Column="1" VerticalAlignment="Top" Width="50" Grid.ColumnSpan="2"/>
|
||||
<Label Name="lblSirtMin" Content="-" HorizontalAlignment="Left" Height="25" Margin="0,0,0,0" Grid.Row="3" Grid.Column="1" VerticalAlignment="Top" Width="50"/>
|
||||
|
||||
<Label Content="RSSI" HorizontalAlignment="Left" Height="25" Margin="0,0,0,0" Grid.Row="1" Grid.Column="2" VerticalAlignment="Top" Width="50"/>
|
||||
<Label Name="lblCordRssi" Content="-" HorizontalAlignment="Left" Height="25" Margin="0,0,0,0" Grid.Row="2" Grid.Column="2" VerticalAlignment="Top" Width="50" Grid.ColumnSpan="2"/>
|
||||
<Label Name="lblSirtRssi" Content="-" HorizontalAlignment="Left" Height="25" Margin="0,0,0,0" Grid.Row="3" Grid.Column="2" VerticalAlignment="Top" Width="50"/>
|
||||
|
||||
|
||||
<Label Content="Max" HorizontalAlignment="Left" Height="25" Margin="0,0,0,0" Grid.Row="1" Grid.Column="3" VerticalAlignment="Top" Width="50"/>
|
||||
<Label Name="lblCordMax" Content="-" HorizontalAlignment="Left" Height="25" Margin="0,0,0,0" Grid.Row="2" Grid.Column="3" VerticalAlignment="Top" Width="50" Grid.ColumnSpan="2"/>
|
||||
<Label Name="lblSirtMax" Content="-" HorizontalAlignment="Left" Height="25" Margin="0,0,0,0" Grid.Row="3" Grid.Column="3" VerticalAlignment="Top" Width="50"/>
|
||||
<Button Content="Done" IsEnabled="False" Name="BtnDone" HorizontalAlignment="Left" Height="25" Grid.Row="5" VerticalAlignment="Top" Width="100" Click="BtnDone_Click"/>
|
||||
<Button Content="Skip" IsEnabled="True" x:Name="BtnDone_Copy" HorizontalAlignment="Left" Height="25" Grid.Row="4" VerticalAlignment="Top" Width="100" Click="BtnDone_Copy_Click" />
|
||||
<Button x:Name="btnfrocePam" Content="Force a PAM" Click="BtnfrocePam_Click" HorizontalAlignment="Left" Width="72" Grid.Row="5" Grid.Column="2" Margin="1,0,0,0" Grid.ColumnSpan="2"/>
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,208 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
|
||||
namespace ProductionUiCordonel.UserControls.FinalTest
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for UcRadioCheck.xaml
|
||||
/// </summary>
|
||||
public partial class UcRadioCheck : UserControl
|
||||
{
|
||||
public class UIContainerElement
|
||||
{
|
||||
public int? Value = null;
|
||||
public System.Drawing.Color Color;
|
||||
|
||||
public UIContainerElement(int? value)
|
||||
{
|
||||
Value = value;
|
||||
if (!value.HasValue)
|
||||
{
|
||||
Color = System.Drawing.Color.LightYellow;
|
||||
}
|
||||
else
|
||||
{
|
||||
Color = System.Drawing.Color.Transparent;
|
||||
}
|
||||
}
|
||||
|
||||
public string GetText()
|
||||
{
|
||||
return Value.HasValue ? Value.Value.ToString() : "-";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class UIContainer
|
||||
{
|
||||
public UIContainerElement CordMin;
|
||||
public UIContainerElement SirtMin;
|
||||
public UIContainerElement CordRssi;
|
||||
public UIContainerElement SirtRssi;
|
||||
public UIContainerElement CordMax;
|
||||
public UIContainerElement SirtMax;
|
||||
|
||||
public UIContainer(int? cordMin = null, int? sirtMin = null, int? cordRssi = null, int? sirtRssi = null, int? cordMax = null, int? sirtMax = null)
|
||||
{
|
||||
CordMin = new UIContainerElement(cordMin);
|
||||
SirtMin = new UIContainerElement(sirtMin);
|
||||
CordRssi = new UIContainerElement(cordRssi);
|
||||
SirtRssi = new UIContainerElement(sirtRssi);
|
||||
CordMax = new UIContainerElement(cordMax);
|
||||
SirtMax = new UIContainerElement(sirtMax);
|
||||
|
||||
//only when results from semi are prensent
|
||||
if (CordRssi.Value.HasValue && SirtRssi.Value.HasValue)
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
if (!CordMin.Value.HasValue || CordRssi.Value.Value < CordMin.Value.Value)
|
||||
{
|
||||
success = false;
|
||||
CordMin.Color = System.Drawing.Color.Tomato;
|
||||
CordRssi.Color = System.Drawing.Color.White;
|
||||
}
|
||||
|
||||
if (!SirtMin.Value.HasValue || SirtRssi.Value.Value < SirtMin.Value.Value)
|
||||
{
|
||||
success = false;
|
||||
SirtMin.Color = System.Drawing.Color.Tomato;
|
||||
SirtRssi.Color = System.Drawing.Color.White;
|
||||
}
|
||||
|
||||
if (!CordMax.Value.HasValue || CordRssi.Value.Value > CordMax.Value.Value)
|
||||
{
|
||||
success = false;
|
||||
CordMax.Color = System.Drawing.Color.Tomato;
|
||||
CordRssi.Color = System.Drawing.Color.White;
|
||||
}
|
||||
|
||||
if (!SirtMax.Value.HasValue || SirtRssi.Value.Value > SirtMax.Value.Value)
|
||||
{
|
||||
success = false;
|
||||
SirtMax.Color = System.Drawing.Color.Tomato;
|
||||
SirtRssi.Color = System.Drawing.Color.White;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
CordRssi.Color = System.Drawing.Color.LightGreen;
|
||||
SirtRssi.Color = System.Drawing.Color.LightGreen;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void SetUi(UIContainer uiContainer)
|
||||
{
|
||||
this.Dispatcher.Invoke(DispatcherPriority.Send,
|
||||
new Action(() =>
|
||||
{
|
||||
setLbl(lblCordMin, uiContainer.CordMin);
|
||||
setLbl(lblSirtMin, uiContainer.SirtMin);
|
||||
setLbl(lblCordRssi, uiContainer.CordRssi);
|
||||
setLbl(lblSirtRssi, uiContainer.SirtRssi);
|
||||
setLbl(lblCordMax, uiContainer.CordMax);
|
||||
setLbl(lblSirtMax, uiContainer.SirtMax);
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
private void setLbl(Label lbl, UIContainerElement element)
|
||||
{
|
||||
lbl.Content = element.GetText();
|
||||
lbl.Background =
|
||||
new SolidColorBrush(Color.FromArgb(element.Color.A, element.Color.R, element.Color.G, element.Color.B));
|
||||
}
|
||||
|
||||
|
||||
internal event EventHandler OnRetryRequested;
|
||||
internal event EventHandler OnResetRequested;
|
||||
internal event EventHandler OnDoneRequested;
|
||||
internal event EventHandler OnForceAPam;
|
||||
|
||||
public UcRadioCheck()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnReset_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Task.Run(() => { OnResetRequested?.Invoke(sender, e); });
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Task.Run(() => { OnRetryRequested?.Invoke(sender, e); });
|
||||
}
|
||||
|
||||
internal void ViewResult(int WaitSeconds = 10)
|
||||
{
|
||||
|
||||
|
||||
BtnDone.Dispatcher.Invoke(DispatcherPriority.Send,
|
||||
new Action(() => { BtnDone.IsEnabled = true; }
|
||||
));
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
var waitMS = WaitSeconds * 1000;
|
||||
while (waitMS > 0)
|
||||
{
|
||||
BtnDone.Dispatcher.Invoke(DispatcherPriority.Send,
|
||||
new Action(() => { BtnDone.Content = $"Done({waitMS / 1000}s)"; }
|
||||
));
|
||||
waitMS = waitMS - 1000;
|
||||
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
BtnDone.Dispatcher.Invoke(DispatcherPriority.Send,
|
||||
new Action(() => { BtnDone.Content = $"Done"; }
|
||||
));
|
||||
OnDoneRequested?.Invoke(this, EventArgs.Empty);
|
||||
});
|
||||
}
|
||||
|
||||
private void BtnDone_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Task.Run(() => { OnDoneRequested?.Invoke(sender, e); });
|
||||
BtnDone.IsEnabled = false;
|
||||
}
|
||||
|
||||
private void BtnDone_Copy_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Task.Run(() => { OnDoneRequested?.Invoke(sender, e); });
|
||||
}
|
||||
|
||||
private void BtnfrocePam_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Task.Run(() => { OnForceAPam?.Invoke(sender, e); });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<UserControl x:Class="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"
|
||||
xmlns:local="clr-namespace:ProductionUiCordonel.ctls"
|
||||
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>
|
||||
@@ -0,0 +1,45 @@
|
||||
using ProductionUiCordonel.Model;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ProductionUiCordonel.ctls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ctlMultiModeMarriage.xaml
|
||||
/// </summary>
|
||||
public partial class ctlMultiModeMarriage : UserControl
|
||||
{
|
||||
private MarriageMultiModeViewModel ViewModel = null;
|
||||
public ctlMultiModeMarriage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void setViewModel(MarriageMultiModeViewModel viewModel)
|
||||
{
|
||||
ViewModel = viewModel;
|
||||
//ViewModel.Store();
|
||||
}
|
||||
|
||||
private void btnMarry_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Task<bool>.Run(() =>
|
||||
{
|
||||
return ViewModel.Store();
|
||||
}).ContinueWith(a =>
|
||||
{
|
||||
if (a.Result)
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show("Meter has passed");
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Windows.Forms.MessageBox.Show("Meter not has passed");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<UserControl x:Class="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"
|
||||
xmlns:local="clr-namespace:ProductionUiCordonel.ctls"
|
||||
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>
|
||||
@@ -0,0 +1,135 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
using ProductionUiCordonel.Data;
|
||||
using ProductionUiCordonel.Model;
|
||||
|
||||
namespace ProductionUiCordonel.ctls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ctlMultiModePicking.xaml
|
||||
/// </summary>
|
||||
public partial class ctlMultiModePicking : UserControl
|
||||
{
|
||||
private PickingMultiModeViewModel ViewModel = null;
|
||||
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(() =>
|
||||
{
|
||||
bool 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; }));
|
||||
|
||||
|
||||
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
<UserControl x:Class="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"
|
||||
xmlns:local="clr-namespace:ProductionUiCordonel.ctls"
|
||||
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>
|
||||
@@ -0,0 +1,169 @@
|
||||
using ProductionUiCordonel.Event;
|
||||
using ProductionUiCordonel.Model;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
using Xylem.Common.Logic.ProductionOrderCore.TestResults;
|
||||
|
||||
namespace ProductionUiCordonel.ctls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ctlMultiModePressure.xaml
|
||||
/// </summary>
|
||||
public partial class ctlMultiModePressure : UserControl
|
||||
{
|
||||
public event EventHandler<StringArgs> OnBarcodeInput;
|
||||
|
||||
private PressureMultiModeViewModel ViewModel = null;
|
||||
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(() =>
|
||||
{
|
||||
bool 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 int? BarcodeInputActiveOffset = null;
|
||||
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 == 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net46" />
|
||||
</packages>
|
||||