This commit is contained in:
Stoyan Zlatev 2025-09-16 12:47:45 +02:00
commit 6a84c594bd
33 changed files with 122 additions and 3197 deletions

View File

@ -13,4 +13,4 @@ using System.Reflection;
//
//[assembly: AssemblyVersion("1.2.*.0")]
[assembly: AssemblyVersion("2.8.3.*")]
[assembly: AssemblyVersion("2.8.4.*")]

View File

@ -821,7 +821,7 @@ namespace CordonelAssemblyLine.Model
meter.ReLogin();
}
meter.SetProcessState(DisplayCodes.PickingTested);
var url = $"{ServiceUrls.MeterProcessStateUrl()}SetPickingState?PcbID={meter.PcbId}&FertigungsauftragsNr={_order}";
var url = $"{ServiceUrls.MeterProcessStateUrl()}SetPickingState?PcbID={meter.PcbId}&FertigungsauftragsNr={_order}&successful=1";
var retString = LocalWebRequest.PostRequestAsyncAndGetContent(url);
if (bool.TryParse(retString, out var result))

View File

@ -2115,7 +2115,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
{
WriteRegister("SENSUSRADIO_PersistenceGroup5", new Byte[] { 0x00, 0xff, 0x00, 0xff });
}
if (GetRegistersDic().Any(a => a.Key.RegisterName == "PersistenceGroup6"))
{
WriteRegister("SENSUSRADIO_PersistenceGroup6", new Byte[] { 0x00, 0xff, 0x00, 0xff });
}
WriteRegister("CUSTOMER_AlarmEnableMask", beforeCancelAlarmEnableMask);
WriteRegister("CUSTOMER_AlarmBroadcastMask", beforeCancelAlarmBroadcastMask);
}

View File

@ -1 +1 @@
8cb55c312de586b683d72cf58c13e2801d10e14b767777d98338d3e1473a1213
b03dfbada453427a2bb1275645a5f1b525f29900

@ -1 +1 @@
Subproject commit ffa0abaa0448ba22350982cd3d3560ce1eaab42a
Subproject commit 41c1163d102dbb63572e60c6ffd501e1765d848c

View File

@ -1,137 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.IO;
//using Newtonsoft.Json;
//namespace Xylem.Common.Production.ProductionUiCordonel
//{
// /// <summary>
// /// Configuration of ProductionUi
// /// </summary>
// public class ApplicationSettings
// {
// public class Pos
// {
// public Double Left { get; set; }
// public Double Top { get; set; }
// public Double Height { get; set; }
// public Double Width { get; set; }
// }
// public class MultiFormChilds
// {
// public Type ViewModelType { get; set; }
// public Boolean Visisble { get; set; }
// public String Name { get; set; }
// public Int32 Slot { get; set; }
// public String TextPort { get; set; }
// public Pos StartPos { get; set; }
// }
// public Int32 Slot { get; set; }
// public Int32? PressureStationId { get; set; }
// public Boolean AutoDetect { get; set; }
// public Boolean AccessToPresuretestTab { get; set; }
// public Boolean AccessToMarrieTab { get; set; }
// public Boolean AccessToFinalcheckTab { get; set; }
// public Boolean AccessToSettingTab { get; set; }
// public Boolean AccessToStatusTab { get; set; }
// public Boolean AccessToPickingTab { get; set; }
// public Int32? SirtComport433 { get; set; }
// public Int32? SirtComport866 { get; set; }
// public Int32? SirtBoxNr { get; set; }
// public Int32? StationId { get; set; }
// public List<MultiFormChilds> ChildForms { get; set; }
// /// <summary>
// /// ctor
// /// </summary>
// public ApplicationSettings()
// {
// Slot = 0;
// AutoDetect = false;
// AccessToPresuretestTab = false;
// AccessToMarrieTab = false;
// AccessToFinalcheckTab = false;
// AccessToSettingTab = false;
// AccessToPickingTab = false;
// AccessToStatusTab = false;
// PressureStationId = null;
// SirtComport433 = null;
// SirtComport866 = null;
// SirtBoxNr = null;
// ChildForms = new List<MultiFormChilds>();
// StationId = null;
// }
// /// <inheritdoc />
// public ApplicationSettings(String file)
// {
// //var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
// //nameof(Xylem.Common.Hardware.WaterMeter.Genesis), file);
// //if (!File.Exists(configFile))
// //{
// var configFile = Path.Combine(file);
// if (!File.Exists(configFile))
// {
// Slot = 0;
// AutoDetect = false;
// AccessToPresuretestTab = false;
// AccessToMarrieTab = false;
// AccessToFinalcheckTab = false;
// AccessToSettingTab = false;
// AccessToPickingTab = false;
// AccessToStatusTab = false;
// PressureStationId = null;
// ChildForms = new List<MultiFormChilds>();
// StationId = null;
// return;
// }
// //}
// using (var tr = new StreamReader(configFile))
// {
// var meterConfig = JsonConvert.DeserializeObject<ApplicationSettings>(tr.ReadToEnd());
// if (meterConfig != null)
// {
// Slot = meterConfig.Slot;
// AutoDetect = meterConfig.AutoDetect;
// AccessToPresuretestTab = meterConfig.AccessToPresuretestTab;
// AccessToMarrieTab = meterConfig.AccessToMarrieTab;
// AccessToFinalcheckTab = meterConfig.AccessToFinalcheckTab;
// AccessToSettingTab = meterConfig.AccessToSettingTab;
// AccessToPickingTab = meterConfig.AccessToPickingTab;
// AccessToStatusTab = meterConfig.AccessToStatusTab;
// PressureStationId = meterConfig.PressureStationId;
// ChildForms = meterConfig.ChildForms;
// StationId = meterConfig.StationId;
// }
// }
// }
// public void Update(String file)
// {
// var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
// nameof(Hardware.WaterMeter.Genesis), file);
// if (!File.Exists(configFile))
// {
// configFile = Path.Combine(file);
// }
// File.WriteAllText(file, JsonConvert.SerializeObject(this));
// }
// }
//}

View File

@ -1,102 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//using System.Windows.Forms;
//namespace ProductionUiCordonel.BarcodeInput
//{
// public class Listener : NativeWindow
// {
// /// <summary>
// /// Initializes a new instance of the BarcodeScannerListener
// /// class. The raw input devices that this class will listen to are
// /// registered with the given window handle.
// /// </summary>
// /// <param name="form">the form that should listen for
// /// barcode scans</param>
// /// <exception cref="ArgumentNullException">if the form is null</exception>
// /// <exception cref="ApplicationException">if we are unable to register
// /// for raw input devices</exception>
// /// <exception cref="ConfigurationErrorsException">if an error occurs
// /// during configuration</exception>
// public Listener(Form form)
// {
// IntPtr hwnd;
// if (form == null)
// {
// throw new ArgumentNullException("form");
// }
// hwnd = form.Handle;
// HookRawInput(hwnd); // We'll take a look at this in a minute
// this.HookHandleEvents(form);
// this.AssignHandle(hwnd);
// }
// /// <summary>
// /// Registers ourselves to listen to raw input from keyboard-like devices.
// /// </summary>
// /// <param name="hwnd">the handle of the form that will receive the raw
// /// input messages</param>
// /// <exception cref="InvalidOperationException">if the call to register with the
// /// raw input API fails for some reason</exception>
// private static void HookRawInput(IntPtr hwnd)
// {
// NativeMethods.RAWINPUTDEVICE[] rid;
// rid = new NativeMethods.RAWINPUTDEVICE[1];
// rid[0].usUsagePage = 0x01; // USB HID Generic Desktop Page
// rid[0].usUsage = 0x06; // Keyboard Usage ID
// rid[0].dwFlags = NativeMethods.RawInputDeviceFlags.RIDEV_INPUTSINK;
// rid[0].hwndTarget = hwnd;
// if (!NativeMethods.RegisterRawInputDevices(rid, (uint)rid.Length, (uint)Marshal.SizeOf(rid[0])))
// {
// InvalidOperationException e;
// e = new InvalidOperationException(
// "The barcode scanner listener could not register for raw input devices.",
// new Win32Exception());
// throw e;
// }
// }
// /// <summary>
// /// Hooks into the form's HandleCreated and HandleDestoryed events
// /// to ensure that we start and stop listening at appropriate times.
// /// </summary>
// /// <param name="form">the form to listen to</param>
// private void HookHandleEvents(Form form)
// {
// form.HandleCreated += this.OnHandleCreated;
// form.HandleDestroyed += this.OnHandleDestroyed;
// }
// /// <summary>
// /// When the form's handle is created, let's hook into it so we can see
// /// the WM_INPUT event.
// /// </summary>
// /// <param name="sender">the form whose handle was created</param>
// /// <param name="e">the event arguments</param>
// private void OnHandleCreated(object sender, EventArgs e)
// {
// this.AssignHandle(((Form)sender).Handle);
// }
// /// <summary>
// /// When the form's handle is destroyed, let's unhook from it so we stop
// /// listening and allow the OS to free up its resources.
// /// </summary>
// /// <param name="sender">the form whose handle was destroyed</param>
// /// <param name="e">the event arguments</param>
// private void OnHandleDestroyed(object sender, EventArgs e)
// {
// this.ReleaseHandle();
// }
// }
//}

View File

@ -1,101 +0,0 @@
namespace ProductionUiCordonel.Data
{
/// <summary>
/// Genesis meter final test states
/// </summary>
public enum FinalTestState
{
/// <summary>
/// Idle (nothing to do)
/// </summary>
Idle,
/// <summary>
/// Start the initial execution
/// </summary>
StartInitial,
/// <summary>
/// Error handling
/// </summary>
Error,
/// <summary>
/// Single processing step failed
/// </summary>
StepFailed,
/// <summary>
/// Repeat last step
/// </summary>
RepeatStep,
/// <summary>
/// Repeat the entire final test
/// </summary>
RepeatFinalTest,
/// <summary>
/// Final test failed
/// </summary>
FinalTestFailed,
/// <summary>
/// Check the actual shipping state
/// </summary>
CheckShippingState,
/// <summary>
/// Check the attachments
/// </summary>
CheckAttachments,
/// <summary>
/// Check the order number
/// </summary>
CheckOrderNumber,
/// <summary>
/// Check the serial number
/// </summary>
CheckSerialNumber,
/// <summary>
/// Connect to Cordonel
/// </summary>
ConnectCordonel,
/// <summary>
/// Store all configurations to FLASH memory
/// </summary>
StoreAllConfigurations,
/// <summary>
/// Reboot the Cordonel to check all parameters being stored to FLASH memory
/// </summary>
RebootCordonel,
/// <summary>
/// Finalize process
/// </summary>
FinalizeProcess,
/// <summary>
/// Final parametrization fixed values
/// </summary>
FinalParametrizationFix,
/// <summary>
/// Final parametrization with VAKO and CSD
/// </summary>
FinalParametrizationVakoCsd,
/// <summary>
/// Read out all parametrization values
/// </summary>
FullReadOutParametrization,
/// <summary>
/// Check all settings for against required values
/// </summary>
ConfigurationCheck,
/// <summary>
/// Acquire, process set the password file
/// </summary>
ProcessPasswordFile,
/// <summary>
/// Process special configuration
/// </summary>
ProcessSpecialConfig,
/// <summary>
/// Prepare shipping mode
/// </summary>
PrepareShippingMode,
/// <summary>
/// Delimiter for list
/// </summary>
StateListDelimiter
}
}

View File

@ -1,52 +0,0 @@
using System;
using System.Linq;
using ProductionUiCordonel.Properties;
namespace ProductionUiCordonel.Data
{
/// <summary>
/// Concatenation of state and string
/// </summary>
public static class FinalTestStateInfo
{
/// <summary>
/// Build state information
/// </summary>
private static readonly FinalTestStateText[] StateInfos;
/// <summary>
/// Ctor
/// </summary>
static FinalTestStateInfo()
{
StateInfos = new FinalTestStateText[(Int32)FinalTestState.StateListDelimiter];
StateInfos[(Int32)FinalTestState.Idle].State = FinalTestState.Idle;
StateInfos[(Int32)FinalTestState.Idle].Message = Resources.StrStateIdle;
StateInfos[(Int32)FinalTestState.StartInitial].State = FinalTestState.StartInitial;
StateInfos[(Int32)FinalTestState.StartInitial].Message = Resources.StrStateStartInitial;
}
/// <summary>
/// Get the current information
/// </summary>
/// <param name="state">state to search for information text</param>
public static String GetTextFromState(FinalTestState state)
{
return (from stateInfo in StateInfos
where stateInfo.State == state
select stateInfo.Message).FirstOrDefault();
}
/// <summary>
/// Get the state of the text
/// </summary>
/// <param name="text">information text to search if state is assigned</param>
public static FinalTestState GetStateFromText(String text)
{
return (from stateInfo in StateInfos
where stateInfo.Message == text
select stateInfo.State).FirstOrDefault();
}
}
}

View File

@ -1,19 +0,0 @@
using System;
namespace ProductionUiCordonel.Data
{
/// <summary>
/// Concatenation between final test state and text
/// </summary>
public struct FinalTestStateText
{
/// <summary>
/// The state of the final test
/// </summary>
public FinalTestState State;
/// <summary>
/// The message text of the final test state
/// </summary>
public String Message;
}
}

View File

@ -1,120 +0,0 @@
using System;
using System.Windows.Media;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
namespace Xylem.Common.Production.ProductionUiCordonel.Data
{
public class PickingItemCheckReturn
{
public Boolean? Result;
public String Msg;
}
public abstract class PickingResultBaseData : IPickingResultData
{
public String Ident { get; set; }
public Int32 Index { get; set; }
public String CheckText { get; set; }
public String CurrentValueText { get; set; }
public Boolean? Result { get; set; }
public Boolean HasError { get; set; }
public Brush ResultColor => getColorFromResult();
public abstract Func<PickingItemCheckReturn> Action { get; }
private Brush getColorFromResult()
{
var converter = new BrushConverter();
var brush = (Brush)converter.ConvertFromString("#000000");
if (Result.HasValue) // && a.Result.Value ))
{
if (!Result.Value)
{
brush = (Brush)converter.ConvertFromString("#FF8000");
}
else
{
brush = (Brush)converter.ConvertFromString("#419C14");
}
}
return brush;
}
}
public interface IPickingResultData
{
String Ident { get; set; }
Int32 Index { get; set; }
String CheckText { get; set; }
String CurrentValueText { get; set; }
Boolean? Result { get; set; }
Boolean HasError { get; set; }
Brush ResultColor { get; }
Func<PickingItemCheckReturn> Action { get; }
}
public class PickingResultRegisterData : PickingResultBaseData
{
public String RegisterIdent { get; set; }
public GenesisMeter ReadMeter { get; set; }
public Object CompareObject { get; set; }
public override Func<PickingItemCheckReturn> Action => staticReadAndCompareAction();
public Func<PickingItemCheckReturn> staticReadAndCompareAction()
{
return delegate
{
var retComp = new PickingItemCheckReturn();
retComp.Result = null;
retComp.Msg = "-";
if (ReadMeter != null && ReadMeter.IsLoggedOn)
{
var r = ReadMeter.ReadRegister(RegisterIdent);
if (CompareObject is UInt32 intNumber)
{
retComp.Result = intNumber.Equals(RegisterConverter.ByteArrayToValue<UInt32>(r));
retComp.Msg = intNumber.ToString();
}
else if (CompareObject is Boolean boolCompare)
{
retComp.Result = boolCompare.Equals(RegisterConverter.ByteArrayToValue<Boolean>(r));
retComp.Msg = boolCompare.ToString();
}
}
return retComp;
};
}
}
public class PickingResultCustomCheckData : PickingResultBaseData
{
public PickingResultCustomCheckData(Func<PickingItemCheckReturn> action)
{
_action = action;
}
public readonly Func<PickingItemCheckReturn> _action;
public override Func<PickingItemCheckReturn> Action => _action;
}
}

View File

@ -1,162 +0,0 @@
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using Xylem.Common.Logic.ProductionOrderCore.TestResults;
namespace Xylem.Common.Production.ProductionUiCordonel.Data
{
public class PressureResultDataNotifyable : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public PressureResultDataNotifyable(PressureResultData baseData)
{
LeakRate = baseData.LeakRate;
Passed = baseData.Passed;
PcbId = baseData.PcbId;
Remark = baseData.Remark;
Rev = baseData.Rev;
TesterName = baseData.TesterName;
Testpoints = new ObservableCollection<PressureTestPoints>();
baseData.TestPoints.ForEach(o => Testpoints.Add(o));
TestPressure = baseData.TestPressure;
}
public PressureResultDataNotifyable()
{
}
public void InternalPropertyChanged(String propertyName = "")
{
NotifyPropertyChanged(propertyName);
}
public String PcbId;
private Int32 rev;
public Int32 Rev
{
get => rev;
set
{
rev = value;
InternalPropertyChanged(nameof(Rev));
}
}
private Boolean? passed = false;
public Boolean? Passed
{
get => passed;
set
{
passed = value;
InternalPropertyChanged(nameof(Passed));
}
}
private String testerName = "C. Röhl";
public String TesterName
{
get => testerName;
set
{
testerName = value;
InternalPropertyChanged(nameof(TesterName));
}
}
private String testPressure = "6";
public String TestPressure
{
get => testPressure;
set
{
testPressure = value;
InternalPropertyChanged(nameof(TestPressure));
}
}
private String leakRate = " 0,00001";
public String LeakRate
{
get => leakRate;
set
{
leakRate = value;
InternalPropertyChanged(nameof(LeakRate));
}
}
private String remark = "";
public String Remark
{
get => remark;
set
{
remark = value;
InternalPropertyChanged(nameof(Remark));
}
}
private ObservableCollection<PressureTestPoints> testpoints = new ObservableCollection<PressureTestPoints>
{
new PressureTestPoints { Ident = 1, Input = "2E-07" },
new PressureTestPoints { Ident = 2, Input = "2E-07" },
new PressureTestPoints { Ident = 3, Input = "2E-07" },
new PressureTestPoints { Ident = 4, Input = "2E-07" },
new PressureTestPoints { Ident = 5, Input = "2E-07" },
new PressureTestPoints { Ident = 6, Input = "2E-07" },
new PressureTestPoints { Ident = 7, Input = "2E-07" },
new PressureTestPoints { Ident = 8, Input = "2E-07" },
new PressureTestPoints { Ident = 9, Input = "2E-07" },
new PressureTestPoints { Ident = 10, Input = "2E-07" }
};
public ObservableCollection<PressureTestPoints> Testpoints
{
get => testpoints;
set
{
testpoints = value;
InternalPropertyChanged(nameof(Testpoints));
}
}
internal void SetAllTestPoints(String input)
{
foreach (var item in Testpoints)
{
item.Input = input;
}
InternalPropertyChanged(nameof(Testpoints));
}
public PressureResultData ToBase()
{
var baseData = new PressureResultData();
baseData.LeakRate = LeakRate;
baseData.Passed = Passed;
baseData.PcbId = PcbId;
baseData.Remark = Remark;
baseData.Rev = Rev;
baseData.TesterName = TesterName;
baseData.TestPoints = Testpoints.ToList();
baseData.TestPressure = TestPressure;
return baseData;
}
}
}

View File

@ -1,12 +0,0 @@
using System;
using System.ComponentModel;
namespace Xylem.Common.Production.ProductionUiCordonel.Model
{
public interface IMultiModeChildViewModel : INotifyPropertyChanged, IDisposable
{
String GetChildIdent();
void InputText(String text);
}
}

View File

@ -1,158 +0,0 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks;
using System.Windows;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
using Xylem.Common.Logic.SoftwareAccessHelper;
namespace Xylem.Common.Production.ProductionUiCordonel.Model
{
public class MarriageMultiModeViewModel : BaseMultiModeChildViewModel
{
private Boolean canMarry;
public Boolean CanMarry
{
get => canMarry;
set
{
canMarry = value;
NotifyPropertyChanged();
}
}
private Int32 serialNr;
public Int32 SerialNr
{
get => serialNr;
set
{
serialNr = value;
NotifyPropertyChanged();
}
}
private Boolean locked = false;
public MarriageMultiModeViewModel(String ctrName, Int32 slotNR, List<String> barcodeTrigger, Int32? stationID = null) :
base(ctrName, slotNR, barcodeTrigger, stationID)
{
VisibilityMarriage = Visibility.Visible;
MeterDetectedHandler += PickingMultiModeViewModel_MeterDetectedHandler;
}
internal async Task<Boolean> Store()
{
var url = $"{ServiceUrls.MarriageServiceUrl()}SetPcbToSerial?PcbId={CurrentPcbID}&SerialNumber={SerialNr}&returnMetroData=0";
return await Task.Run(() =>
{
try
{
//url = "http://10.49.40.25/MeterProcessState/api/Marriage/SetPcbToSerial?PcbId=201420242&SerialNumber=20728820&returnMetroData=1";
var resp = LocalWebRequest.GetRequest(url);
if (!string.IsNullOrEmpty(resp))
{
if (CurrentMeter != null)
{
CurrentMeter.Login();
//if (resp.Trim() != "store")
//{
// var myJsonResponse = JsonConvert.DeserializeObject<IList<Programming_programming_parameters>>(resp);
// foreach (var item in myJsonResponse)
// {
// CurrentMeter.WriteRegister(item.RegisterName, item.RegisterValue);
// }
//}
CurrentMeter.SetProcessState(DisplayCodes.Mounted);
CurrentMeter.GetLastProcessState();
}
return true;
}
Log($"No result for {url} on Store");
return false;
}
catch (Exception ex)
{
if (ex is WebException)
{
Log($"Error on Store {url}: {Environment.NewLine} {((WebException)ex).Message}");
}
else
{
Log(ex.Message);
}
}
return false;
});
}
private void PickingMultiModeViewModel_MeterDetectedHandler(Object sender, EventArgs e)
{
CheckBtnEnable();
}
private void CheckBtnEnable()
{
if (SerialNr > 0 && !string.IsNullOrEmpty(CurrentPcbID))
{
CanMarry = true;
}
else
{
CanMarry = false;
}
}
public override void InputText(String text)
{
try
{
SerialNr = 0;
text = text.Replace(" ", "");
var preFix = "8SEN20";
if (text.Contains(preFix) && text.Contains(","))
{
var tmpSerialNr = 0;
var srText = text.Substring(text.IndexOf(preFix) + preFix.Length, text.IndexOf(",") - preFix.Length);
if (int.TryParse(srText, out tmpSerialNr))
{
SerialNr = tmpSerialNr;
}
}
CheckBtnEnable();
}
catch (Exception ex)
{
Log(ex.Message);
}
finally
{
CheckBtnEnable();
}
}
public override Boolean SlotIsLocked()
{
return locked;
}
}
}

View File

@ -1,332 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Timers;
using System.Windows;
using NLog;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
using Xylem.Common.Utils.Logging;
namespace Xylem.Common.Production.ProductionUiCordonel.Model
{
public abstract class BaseMultiModeChildViewModel : IMultiModeChildViewModel
{
private readonly ILogger _logger;
private Timer tmrAutoDetect;
public EventHandler OnPcbIdDetect;
public List<String> BarcodeTrigger = new List<String>();
private Int32 intervalWithoutDetect = 1000;
private Int32 intervalWithDetect = 10000;
private String _currentPcbID;
private MeterBatch Batch = new MeterBatch();
private Visibility visibilityMarriage = Visibility.Collapsed;
public Visibility VisibilityMarriage
{
get => visibilityMarriage;
set
{
visibilityMarriage = value;
NotifyPropertyChanged();
}
}
private Visibility visibilityPicking = Visibility.Collapsed;
public Visibility VisibilityPicking
{
get => visibilityPicking;
set
{
visibilityPicking = value;
NotifyPropertyChanged();
}
}
private Visibility visibilityPressure = Visibility.Collapsed;
public Visibility VisibilityPressure
{
get => visibilityPressure;
set
{
visibilityPressure = value;
NotifyPropertyChanged();
}
}
public String currentSlotStateText = "none";
public String CurrentSlotStateText
{
get => currentSlotStateText;
set
{
currentSlotStateText = value;
NotifyPropertyChanged();
}
}
private SlotState currentSlotState = SlotState.None;
public SlotState CurrentSlotState
{
get => currentSlotState;
set
{
currentSlotState = value;
switch (currentSlotState)
{
case SlotState.None:
CurrentSlotStateText = "Keiner";
break;
case SlotState.IsDetecting:
CurrentSlotStateText = "Warte auf Zähler Kontakt";
break;
case SlotState.Detected:
CurrentSlotStateText = "Zähler detektiert";
break;
case SlotState.InProgress:
CurrentSlotStateText = "Zähler wird bearbeitet";
break;
case SlotState.Done:
CurrentSlotStateText = "Zähler wurde bearbeitet";
break;
case SlotState.ConnectionLost:
CurrentSlotStateText = "Verbindung getrennt";
break;
case SlotState.Error:
CurrentSlotStateText = "Fehler beim bearbeitet";
break;
case SlotState.Fatal:
CurrentSlotStateText = "Schwerwiegender Fehler";
break;
}
NotifyPropertyChanged();
}
}
private String slotInfo = "-";
public String SlotInfo
{
get => slotInfo;
set
{
slotInfo = value;
NotifyPropertyChanged();
}
}
public enum SlotState
{
None,
IsDetecting,
Detected,
InProgress,
Done,
ConnectionLost,
Error,
Fatal
}
private String childName = "asd";
public String ChildName
{
get => childName;
set
{
childName = value;
NotifyPropertyChanged();
}
}
private String order;
public String Order
{
get => order;
set
{
order = value;
NotifyPropertyChanged();
}
}
public String CurrentPcbID
{
get => _currentPcbID;
set
{
_currentPcbID = value;
NotifyPropertyChanged();
}
}
public GenesisMeter CurrentMeter { get; private set; }
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public String GetChildIdent()
{
return ChildName;
}
public Int32 SlotNr;
public BaseMultiModeChildViewModel(String ctrName, Int32 slotNR,List<String> barcodeTrigger, Int32? StationId = null, Boolean useTimer = true)
{
_logger = NLogHelper.CreateOrGetLogger("ProductionUI");
ChildName = ctrName;
SlotNr = slotNR;
SlotInfo = SlotNr.ToString();
if (useTimer)
{
tmrAutoDetect = new Timer(intervalWithoutDetect);
tmrAutoDetect.Elapsed += TmrAutoDetect_Elapsed;
tmrAutoDetect.Enabled = true;
}
BarcodeTrigger = barcodeTrigger;
}
public void TmrAutoDetect_Elapsed(Object sender, EventArgs e)
{
CurrentSlotState = SlotState.IsDetecting;
tmrAutoDetect.Enabled = false;
var hasDetect = Detect(SlotNr);
if (hasDetect)
{
CurrentSlotState = SlotState.Detected;
tmrAutoDetect.Interval = intervalWithDetect;
}
else
{
tmrAutoDetect.Interval = intervalWithoutDetect;
}
tmrAutoDetect.Enabled = true;
}
public void TextForceUpdate()
{
var hasDetect = Detect(SlotNr);
if (hasDetect)
{
CurrentSlotState = SlotState.Detected;
}
}
public virtual void InputText(String text)
{
Order = text;
}
public void Log(String txt)
{
_logger?.Info(txt);
}
public abstract Boolean SlotIsLocked();
public event EventHandler MeterDetectedHandler;
private Boolean Detect(Int32 slot)
{
if (!SlotIsLocked())
{
Log("Start Detect");
Boolean hasDetect = false;
if (string.IsNullOrEmpty(CurrentPcbID) || CurrentMeter == null)
{
Batch = new MeterBatch();
var tryMeter = new GenesisMeter();
try
{
tryMeter.SetupFromConfigFile(slot);
Batch.AddMeter(tryMeter);
tryMeter.Logout();
Log("Try to get PcbID");
CurrentPcbID = tryMeter.GetPcbId();
hasDetect = !string.IsNullOrEmpty(CurrentPcbID);
CurrentMeter = tryMeter;
if (hasDetect)
{
Log($"New PcbID detected {CurrentPcbID}");
MeterDetectedHandler?.Invoke(CurrentMeter, EventArgs.Empty);
}
else
{
Log("No Meter found");
DisposeAllConnections();
}
}
catch (Exception e)
{
Log($"Error occur.{ Environment.NewLine} {e.Message}");
}
}
else
{
Log("Check if Meter is still connected");
var ret = CurrentMeter.GetPcbId();
if (string.IsNullOrEmpty(ret) || ret != CurrentPcbID)
{
Log("Meter connection lost");
hasDetect = false;
DisposeAllConnections();
CurrentPcbID = "";
}
else
{
Log("Meter is still connected");
hasDetect = true;
}
}
return hasDetect;
}
Log("Meter is still connected (locked)");
return true;
}
private void DisposeAllConnections()
{
MeterDetectedHandler?.Invoke(null, EventArgs.Empty);
if (Batch != null)
{
Batch.RemoveAllMeters();
if (CurrentMeter != null)
{
CurrentMeter.Dispose();
}
Batch.Dispose();
}
}
public void Dispose()
{
DisposeAllConnections();
}
}
}

View File

@ -1,516 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO.Ports;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Media;
using Logic.ProductionToProductMapper.Cordonel;
using Newtonsoft.Json;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
using Xylem.Common.Logic.SoftwareAccessHelper;
namespace Xylem.Common.Production.ProductionUiCordonel.Model
{
internal class MultiModeMasterViewModel : INotifyPropertyChanged
{
private String pickingState = "Warte auf Scanner";
private String pickingScanner = "keine Verbindung";
private String pickingSlot = "-";
private String pickingResult = "-";
private Brush pickingResultColor;
public Brush PickingResultColor
{
get => pickingResultColor;
set
{
pickingResultColor = value;
NotifyPropertyChanged();
}
}
public String PickingState
{
get => pickingState;
set
{
pickingState = value;
NotifyPropertyChanged();
}
}
public String PickingScanner
{
get => pickingScanner;
set
{
pickingScanner = value;
NotifyPropertyChanged();
}
}
public String PickingSlot
{
get => pickingSlot;
set
{
pickingSlot = value;
NotifyPropertyChanged();
}
}
public String PickingResult
{
get => pickingResult;
set
{
pickingResult = value;
NotifyPropertyChanged();
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public void StartPicking(CancellationTokenSource cancle)
{
var s = new Task(() => { PickingLoop(cancle.Token); }, cancle.Token);
s.Start();
}
public enum PickingStateMachine
{
Init,
WaitForScanning,
ScanningDone,
WaitForDetect,
GetOrderDetails,
Compare,
MeterDone,
MeterError,
StartCom,
WaitForBuildingMeterReady,
WaitForBuildingPressureReady,
}
private PickingStateMachine sm = PickingStateMachine.Init;
private class BarScanner : IDisposable
{
private Boolean isRuning;
public String Input = "";
private String Port;
private CancellationToken Cancellation;
private Task WaitForScannerTask;
public BarScanner(String port, CancellationToken cancellation)
{
Port = port;
Cancellation = cancellation;
}
public void Start()
{
if (!isRuning)
{
if (Port == null)
{
return;
}
WaitForScannerTask = new Task(() =>
{
using (var a = new SerialPort(Port))
{
a.Open();
a.NewLine = "\r";
while (true)
{
if (Cancellation.IsCancellationRequested)
{
isRuning = false;
break;
}
Input = a.ReadLine();
a.Close();
isRuning = false;
break;
}
}
}, Cancellation);
WaitForScannerTask.Start();
}
}
public void Dispose()
{
if (WaitForScannerTask.Status != TaskStatus.Faulted && WaitForScannerTask.Status != TaskStatus.RanToCompletion && WaitForScannerTask.Status != TaskStatus.Canceled)
{
WaitForScannerTask.Dispose();
}
}
}
public Boolean Compare(Dictionary<UInt32, UInt32> checkAppsIdVersion, UInt32 Frequency, UInt32 MeterSize, Boolean PressurePresent)
{
using (var Batch = new MeterBatch())
{
using (var meter = new GenesisMeter())
{
meter.SetupFromConfigFile(PickingSlotNr);
Batch.AddMeter(meter);
PickingState = "Am Zähler anmelden";
if (meter.Login())
{
meter.SetProcessState(DisplayCodes.PickingStarted);
var ret = RunCheck(checkAppsIdVersion, Frequency, MeterSize, PressurePresent, meter);
if (ret)
{
meter.SetProcessState(DisplayCodes.PickingTested);
var url = $"{ServiceUrls.MeterProcessStateUrl()}SetPickingState?PcbID={meter.PcbId}&FertigungsauftragsNr={PickingOrder}";
var RetString = LocalWebRequest.PostRequestAsyncAndGetContent(url);
var result = false;
if (bool.TryParse(RetString, out result))
{
return result;
}
}
else
{
meter.SetProcessState(DisplayCodes.PickingFailed);
}
}
}
}
return false;
}
private Boolean RunCheck(Dictionary<UInt32, UInt32> checkAppsIdVersion, UInt32 Frequency, UInt32 MeterSize, Boolean PressurePresent, GenesisMeter meter)
{
PickingState = "Üperprüfe Parameter";
var FrequencyReadOut = RegisterConverter.ByteArrayToValue<UInt32>(meter.ReadRegister("SENSUSRADIO_FrequencyIndicator"));
if (FrequencyReadOut != Frequency)
{
PickingState = $"Falsche Frequenz! soll {Frequency}MHz ist {FrequencyReadOut}MHz";
return false;
}
var MeterSizeReadOut = RegisterConverter.ByteArrayToValue<UInt32>(meter.ReadRegister("GENESISFLOW_MeterSize"));
if (MeterSizeReadOut != MeterSize)
{
PickingState = $"Meter Dn falsch! soll {MeterSize}DN ist {MeterSizeReadOut}DN";
return false;
}
var PressureReadOut = RegisterConverter.ByteArrayToValue<Boolean>(meter.ReadRegister("METROLOGYASST_PressurePresent"));
if (PressureReadOut != PressurePresent)
{
if (PressurePresent)
{
PickingState = "Pcb mit Drucksensor. Laut Auftrag keine verbaut";
}
else
{
PickingState = "Pcb ohne Drucksensor. Laut Auftrag soll eine verbaut werden";
}
//todo raus
return false;
}
foreach (var item in checkAppsIdVersion)
{
try
{
var MeterFWApp = meter.MeterAppListVersion.First(a => item.Key == a.AppId);
if (MeterFWApp == null || MeterFWApp.Version != item.Value)
{
PickingState = "Falsche FW, bitte Updaten";
return false;
}
}
catch (Exception)
{
PickingState = "Fehler beim auslesen der FW";
return false;
}
}
try
{
meter.WriteRegister("METROLOGYASST_StoreConfiguration", 1);
Thread.Sleep(100);
var storeRet = meter.ReadRegister("METROLOGYASST_StoreConfiguration");
if (!storeRet.All(a => a.Equals(0)))
{
PickingState = "Filesystem corrupt";
return false;
}
}
catch (Exception)
{
PickingState = "Fehler beim überprüfen des Filesystems";
return false;
}
return true;
}
private PickingCompareItem PickingOrderDetails;
private BarScanner PickingBarScanner;
private String PickingOrder;
private String PickingPcbId;
private String PickingScannerPort = "COM6";
private Int32 PickingSlotNr = 1;
//PickingState,PickingScanner,PickingSlot,PickingResult
private void PickingLoop(CancellationToken token)
{
while (!token.IsCancellationRequested)
{
switch (sm)
{
case PickingStateMachine.Init:
PickingState = "Initialisierung";
PickingSlot = $"Inaktiv EP {PickingSlotNr}";
PickingScanner = $"Geschlossen {PickingScannerPort}";
//CheckAllPorts?
sm = PickingStateMachine.StartCom;
break;
case PickingStateMachine.StartCom:
PickingOrderDetails = null;
PickingScanner = $"Öfffne {PickingScannerPort}";
//CheckAllPorts?
PickingBarScanner = new BarScanner(PickingScannerPort, token);
PickingBarScanner.Start();
sm = PickingStateMachine.WaitForScanning;
break;
case PickingStateMachine.WaitForScanning:
PickingScanner = $"Offen {PickingScannerPort}";
PickingState = $"Warte auf Scannereingabe({PickingScannerPort})";
if (PickingBarScanner != null && !string.IsNullOrEmpty(PickingBarScanner.Input))
{
PickingOrder = PickingBarScanner.Input;
PickingScanner = $"Geschlossen {PickingScannerPort}";
PickingBarScanner = null;
sm = PickingStateMachine.WaitForDetect;
}
break;
case PickingStateMachine.WaitForDetect:
using (var Batch = new MeterBatch())
{
using (var tryMeter = new GenesisMeter())
{
try
{
PickingState = "Warte auf Pcb";
PickingSlot = $"Öffne EP {PickingSlotNr}";
tryMeter.SetupFromConfigFile(PickingSlotNr);
Batch.AddMeter(tryMeter);
tryMeter.Logout();
Log("Try to get PcbID");
PickingPcbId = tryMeter.GetPcbId();
var hasDetect = !string.IsNullOrEmpty(PickingPcbId);
if (hasDetect)
{
PickingState = $"Pcb gefunden {PickingPcbId}";
Log($"New PcbID detected {PickingPcbId}");
sm = PickingStateMachine.GetOrderDetails;
}
else
{
PickingSlot = $"Keine Konnektivität EP {PickingSlotNr}";
Log("No Meter found");
}
}
catch (Exception e)
{
Log($"Error occur.{ Environment.NewLine} {e.Message}");
}
}
}
break;
case PickingStateMachine.GetOrderDetails:
PickingState = $"Lade Auftragsdaten {PickingOrder}";
var retCode = 0;
var str = LocalWebRequest.GetRequestWithError($"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetOrderOverview?ProductionOrderNumber={PickingOrder}&CheckPcbId={PickingPcbId}", out retCode, 15000);
if (retCode == 417)
{
sm = PickingStateMachine.MeterError;
PickingResult = "Keine Radio Parameter";
}
else
{
var retStr = JsonConvert.DeserializeObject<OrderOverViewCordonelWithPicking>(str);
PickingOrderDetails = retStr.PickingCompareItem;
if (retStr.OrderOverViewCordonel.Count == retStr.OrderOverViewCordonel.AssignedPicking)
{
PickingResult = "Auftrag schon komplett";
sm = PickingStateMachine.MeterError;
}
else
{
PickingState = $"Auftragsdaten geladen {PickingOrder}";
sm = PickingStateMachine.Compare;
}
}
break;
case PickingStateMachine.Compare:
//Compare
PickingState = $"Vergleiche Auftragsdaten {PickingOrder} mit Pcb Eigenschaften";
var converter = new BrushConverter();
if (Compare(PickingOrderDetails.CheckAppsIdVersion, PickingOrderDetails.FrequencyIndicator, PickingOrderDetails.MeterSize, PickingOrderDetails.PressurePresent))
{
//erfolg anzeigen und weiter
var b = (Brush)converter.ConvertFromString("#419C14");
b.Freeze();
PickingResultColor = b;
sm = PickingStateMachine.MeterDone;
}
else
{
sm = PickingStateMachine.MeterError;
var b = (Brush)converter.ConvertFromString("#FF8000");
b.Freeze();
PickingResultColor = b;
}
break;
case PickingStateMachine.MeterError:
PickingOrderDetails = null;
PickingState = "Vergleich abgeschlossen";
PickingResult = "Vergleich fertig fehlgeschlagen";
Thread.Sleep(10000);
sm = PickingStateMachine.StartCom;
break;
case PickingStateMachine.MeterDone:
PickingState = "Vergleich abgeschlossen warten auf Montage Rückmeldung";
PickingResult = $"Pcb {PickingPcbId} wurde dem Auftrag {PickingOrder} hinzugefügt";
Thread.Sleep(10000);
PickingScanner = $"Öfffne {PickingScannerPort}";
PickingBarScanner = new BarScanner(PickingScannerPort, token);
PickingBarScanner.Start();
sm = PickingStateMachine.WaitForBuildingMeterReady;
//CheckAllPorts?
break;
case PickingStateMachine.WaitForBuildingMeterReady:
if (PickingBarScanner != null && !string.IsNullOrEmpty(PickingBarScanner.Input))
{
if (PickingBarScanner.Input == "%Cordonel_SAP_100%")
{
var url = ServiceUrls.MeterProcessStateUrl();
url = url + $"setSapState?PcbID={PickingPcbId}&code=100&version=1";
try
{
LocalWebRequest.PostRequestAsync(url);
}
catch (Exception ex)
{
}
if (PickingOrderDetails.PressurePresent)
{
PickingBarScanner = new BarScanner(PickingScannerPort, token);
PickingBarScanner.Start();
PickingState = "Montage Rückmeldung erhalten, Montage des Drucksensors bestätigen";
sm = PickingStateMachine.WaitForBuildingPressureReady;
}
else
{
PickingState = "Montage Rückmeldung erhalten, auftrag Scannen";
sm = PickingStateMachine.StartCom;
}
}
}
break;
case PickingStateMachine.WaitForBuildingPressureReady:
if (PickingBarScanner != null && !string.IsNullOrEmpty(PickingBarScanner.Input))
{
if (PickingBarScanner.Input == "%Cordonel_SAP_101%")
{
var url = ServiceUrls.MeterProcessStateUrl();
url = url + $"setSapState?PcbID={PickingPcbId}&code=101&version=1";
try
{
LocalWebRequest.PostRequestAsync(url);
}
catch (Exception ex)
{
}
PickingState = "Montage Rückmeldung erhalten, auftrag Scannen";
sm = PickingStateMachine.StartCom;
}
}
break;
}
Thread.Sleep(1000);
}
}
private void Log(String v)
{
//throw new NotImplementedException();
}
}
}

View File

@ -1,440 +0,0 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using Logic.ProductionToProductMapper.Cordonel;
using Newtonsoft.Json;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
using Xylem.Common.Logic.ProductionOrderCore.OrderData;
using Xylem.Common.Logic.SoftwareAccessHelper;
using Xylem.Common.Production.ProductionUiCordonel.Data;
using MessageBox = System.Windows.Forms.MessageBox;
namespace Xylem.Common.Production.ProductionUiCordonel.Model
{
public class PickingMultiModeViewModel : BaseMultiModeChildViewModel
{
private Boolean inputIsEnabled;
public Boolean InputIsEnabled
{
get => inputIsEnabled;
set
{
inputIsEnabled = value;
NotifyPropertyChanged();
}
}
private Boolean locked;
public PickingMultiModeViewModel(String ctrName, Int32 slotNR, List<String> barcodeTrigger, Int32? stationID = null) : base(ctrName, slotNR, barcodeTrigger, stationID, false)
{
VisibilityPicking = Visibility.Visible;
MeterDetectedHandler += PickingMultiModeViewModel_MeterDetectedHandler;
}
private void PickingMultiModeViewModel_MeterDetectedHandler(Object sender, EventArgs e)
{
}
public override Boolean SlotIsLocked()
{
return locked;
}
public override void InputText(String text)
{
Order = text;
ReloadData();
TextForceUpdate();
}
internal void ReloadData()
{
Task.Run((Action)(() =>
{
try
{
if (!locked && !string.IsNullOrEmpty(Order) && Order.Length > 6 && int.TryParse(Order, out var orderNR))
{
var str = LocalWebRequest.GetRequest($"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetOrderOverview?ProductionOrderNumber={orderNR}");
var OrderOverView = JsonConvert.DeserializeObject<OrderOverViewCordonel>(str);
var doneCount = OrderOverView.AssignedPicking;
if (OrderOverView.Count == OrderOverView.AssignedPicking)
{
UpdatePickingUi("Order is already completed", StatusColor, "Input a new order number", 0, 0);
locked = false;
return;
}
str = LocalWebRequest.GetRequestWithError($"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetOrderDetails?ProductionOrderNumber={orderNR}&CheckPcbId={CurrentMeter.PcbId}", out var retCode, 15000);
if (retCode == 417)
{
MessageBox.Show(@"NO radio parameter found");
}
if (OrderOverView.Count == OrderOverView.AssignedPicking)
{
UpdatePickingUi("Order is already completed", StatusColor, "Input a new order number", 0, 0);
locked = false;
return;
}
var OrderDteails = JsonConvert.DeserializeObject<PickingCompareItem>(str);
if (CurrentMeter != null)
{
try
{
locked = true;
//Init(CurrentMeter, new Dictionary<uint, uint>(), OrderDteails.FrequencyIndicator, OrderDteails.MeterSize, OrderDteails.PressurePresent);
var a = new Dictionary<UInt32, UInt32>();
a.Add(0, 486);
a.Add(15, 287);
if (OrderDteails.FrequencyIndicator == 868)
{
a.Add(24, 1067);
}
else
{
a.Add(24, 1066);
}
Init(CurrentMeter, a, OrderDteails.FrequencyIndicator, OrderDteails.MeterSize, OrderDteails.PressurePresent);
var r = Run(CurrentMeter.PcbId, orderNR.ToString());
if (r)
{
doneCount = doneCount + 1;
}
locked = false;
UpdatePickingUi("Start checking meter", StatusColor, orderNR.ToString(), OrderOverView.Count, doneCount);
}
catch (Exception ex)
{
Log(ex.Message);
}
finally
{
locked = false;
}
}
}
else
{
UpdatePickingUi("Please input a valid order number", StatusColor, "no valid order!", 0, 0);
}
}
catch (Exception ex)
{
Log(ex.Message);
}
}));
}
private void UpdatePickingUi(String state, Brush StateColor, String order, Int32 toDo, Int32 done)
{
Message = state;
Order = order;
ToDo = toDo;
Done = done;
OnUpdateUi?.Invoke(null, EventArgs.Empty);
//if (true)
//{
//}
// lblStatus.Content = state;
// lblStatus.Background = StateColor;
// lblPickingOrder.Content = $"{Order}({Done}/{toDo}";
// txtHiddenInput.Focus();
// if (Done > 0 && Done >= toDo)
// {
// MessageBox.Show("Order is Finish");
// txtOrderNr.Text = "";
// lblStatus.Content = "Please input a new order number";
// }
//}));
}
//private void RefreshPicking()
//{
// tbarOrder.Visibility = Visibility.Visible;
// if (!string.IsNullOrEmpty(txtOrderNr.Text))
// {
// lblPickingOrder.Content = orderString;
// }
// else
// {
// UpdatePickingUi("Please input a valid order number", PickingData.StatusColor, "no valid order!", 0, 0);
// }
//}
public event EventHandler OnDataChanged;
public event EventHandler OnUpdateUi;
public new event PropertyChangedEventHandler PropertyChanged;
private GenesisMeter currentMeter;
public ObservableCollection<IPickingResultData> Data
{
get; set;
}
private OverallStatus status = OverallStatus.NoDetect;
private OverallStatus Status
{
get => status;
set
{
status = value;
OnDataChanged?.Invoke(value.GetHashCode(), EventArgs.Empty);
}
}
public String Message
{
get; set;
}
private enum OverallStatus
{
NoDetect,
CheckingIsRunning,
CheckingIsDone,
CheckingIsNoMatch,
CheckingIsHasError,
}
public String StatusText
{
get
{
switch (Status)
{
case OverallStatus.NoDetect:
return "Wait for meter";
case OverallStatus.CheckingIsRunning:
return "Is checking, please wait";
case OverallStatus.CheckingIsDone:
return "Succsesfull check next Pcb";
case OverallStatus.CheckingIsNoMatch:
return "Check has mismatch, this PCB cannot be used!";
default:
return "Check has errors, this PCB cannot be used!";
}
}
}
public Brush StatusColor
{
get
{
switch (Status)
{
case OverallStatus.NoDetect:
return (SolidColorBrush)new BrushConverter().ConvertFromString("White");
case OverallStatus.CheckingIsRunning:
return (SolidColorBrush)new BrushConverter().ConvertFromString("Yellow");
case OverallStatus.CheckingIsDone:
return (SolidColorBrush)new BrushConverter().ConvertFromString("Green");
case OverallStatus.CheckingIsNoMatch:
return (SolidColorBrush)new BrushConverter().ConvertFromString("Red");
default:
return (SolidColorBrush)new BrushConverter().ConvertFromString("DarkRed");
}
}
}
public Int32 ToDo
{
get; private set;
}
public Int32 Done
{
get; private set;
}
public void Init(GenesisMeter meter, Dictionary<UInt32, UInt32> checkAppsIdVersion, UInt32 Frequency, UInt32 MeterSize, Boolean PressurePresent)
{
currentMeter = meter;
var data = new List<IPickingResultData>();
data.Add(new PickingResultCustomCheckData(delegate
{
meter.Login();
meter.SetProcessState(DisplayCodes.PickingStarted);
return new PickingItemCheckReturn { Result = true, Msg = "done" };
})
{
Index = data.Count, Ident = "Login", CheckText = "Try to access Meter", HasError = false, Result = null,
CurrentValueText = "-"
});
data.Add(new PickingResultRegisterData
{
ReadMeter = meter, Index = data.Count, Ident = "Check Radio", CheckText = $"{Frequency}MHz",
CompareObject = Frequency, CurrentValueText = "none", HasError = false, Result = null,
RegisterIdent = "SENSUSRADIO_FrequencyIndicator"
});
data.Add(new PickingResultRegisterData
{
ReadMeter = meter, Index = data.Count, Ident = "MeterSize",
CheckText = "DN40-50", CompareObject = MeterSize, CurrentValueText = "none", HasError = false,
Result = null, RegisterIdent = "GENESISFLOW_MeterSize"
});
data.Add(new PickingResultRegisterData
{
ReadMeter = meter, Index = data.Count, Ident = "Pressure",
CheckText = "Pressure Sensor", CompareObject = PressurePresent, CurrentValueText = "-", HasError = false,
Result = null, RegisterIdent = "METROLOGYASST_PressurePresent"
});
foreach (var item in checkAppsIdVersion)
{
data.Add(new PickingResultCustomCheckData(delegate
{
try
{
var MeterFWApp = meter.MeterAppListVersion.First(a => item.Key == a.AppId);
if (MeterFWApp.Version != item.Value)
{
return new PickingItemCheckReturn { Result = false, Msg = MeterFWApp.StrVersion };
}
return new PickingItemCheckReturn { Result = true, Msg = MeterFWApp.StrVersion };
}
catch (Exception)
{
return new PickingItemCheckReturn { Result = false, Msg = "error" };
}
})
{
Index = data.Count, Ident = $"Check AppId {item.Key}", CheckText = $"Version {item.Value}",
HasError = false, Result = null, CurrentValueText = "-"
});
}
data.Add(new PickingResultCustomCheckData(delegate
{
try
{
meter.WriteRegister("METROLOGYASST_StoreConfiguration", 1);
Thread.Sleep(100);
var storeRet = meter.ReadRegister("METROLOGYASST_StoreConfiguration");
if (storeRet.All(a => a.Equals(0)))
{
return new PickingItemCheckReturn { Result = true, Msg = "Filesystem OK" };
}
return new PickingItemCheckReturn { Result = false, Msg = "Filesystem corrupt" };
}
catch (Exception)
{
return new PickingItemCheckReturn { Result = false, Msg = "error" };
}
})
{
Index = data.Count, Ident = "Check Filesystem", CheckText = "Check Filesystem", HasError = false,
Result = null, CurrentValueText = "checking"
});
Status = OverallStatus.CheckingIsRunning;
ChangeDataData(data);
}
private void ChangeDataData(List<IPickingResultData> data)
{
Data = new ObservableCollection<IPickingResultData>(data);
OnDataChanged?.Invoke(Data, EventArgs.Empty);
}
public Boolean Run(String pcbID, String OrderNr)
{
var tmpData = Data.ToList();
foreach (var item in tmpData.Where(a => !a.Result.HasValue).OrderBy(a => a.Index))
{
var result = item.Action.Invoke();
item.Result = result.Result;
item.CurrentValueText = result.Msg;
ChangeDataData(tmpData);
}
if (tmpData.All(a => !a.HasError && a.Result.HasValue && a.Result.Value))
{
currentMeter.SetProcessState(DisplayCodes.PickingTested);
var url = $"{ServiceUrls.MeterProcessStateUrl()}SetPickingState?PcbID={pcbID}&FertigungsauftragsNr={OrderNr}";
var RetString = LocalWebRequest.PostRequestAsyncAndGetContent(url);
if (bool.TryParse(RetString, out var result))
{
Status = OverallStatus.CheckingIsDone;
return result;
}
Status = OverallStatus.CheckingIsHasError;
return false;
}
currentMeter.SetProcessState(DisplayCodes.PickingFailed);
if (tmpData.All(a => a.HasError))
{
Status = OverallStatus.CheckingIsHasError;
}
else
{
Status = OverallStatus.CheckingIsNoMatch;
}
return false;
}
internal void Empty()
{
Status = OverallStatus.NoDetect;
ChangeDataData(new List<IPickingResultData>());
}
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
{
PropertyChanged?.Invoke(this, e);
}
}
}

View File

@ -1,221 +0,0 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Threading;
using System.Windows.Media;
using Logic.ProductionToProductMapper.Cordonel;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
using Xylem.Common.Logic.SoftwareAccessHelper;
using Xylem.Common.Production.ProductionUiCordonel.Data;
namespace Xylem.Common.Production.ProductionUiCordonel.Model
{
public class PickingViewModel : INotifyPropertyChanged
{
public event EventHandler OnDataChanged;
public event PropertyChangedEventHandler PropertyChanged;
private GenesisMeter currentMeter;
private PickingCompareItem baseFile;
public ObservableCollection<IPickingResultData> Data { get; set; }
private OverallStatus status = OverallStatus.NoDetect;
private OverallStatus Status
{
get => status;
set
{
status = value;
OnDataChanged?.Invoke(value.GetHashCode(), EventArgs.Empty);
}
}
private enum OverallStatus
{
NoDetect,
CheckingIsRunning,
CheckingIsDone,
CheckingIsNoMatch,
CheckingIsHasError,
}
public String StatusText
{
get
{
switch (Status)
{
case OverallStatus.NoDetect:
return "Wait for meter";
case OverallStatus.CheckingIsRunning:
return "Is checking, please wait";
case OverallStatus.CheckingIsDone:
return "Succsesfull check next Pcb";
case OverallStatus.CheckingIsNoMatch:
return "Check has mismatch, this PCB cannot be used!";
default:
return "Check has errors, this PCB cannot be used!";
}
}
}
public Brush StatusColor
{
get
{
switch (Status)
{
case OverallStatus.NoDetect:
return (SolidColorBrush)new BrushConverter().ConvertFromString("White");
case OverallStatus.CheckingIsRunning:
return (SolidColorBrush)new BrushConverter().ConvertFromString("Yellow");
case OverallStatus.CheckingIsDone:
return (SolidColorBrush)new BrushConverter().ConvertFromString("Green");
case OverallStatus.CheckingIsNoMatch:
return (SolidColorBrush)new BrushConverter().ConvertFromString("Red");
default:
return (SolidColorBrush)new BrushConverter().ConvertFromString("DarkRed");
}
}
}
public void Init(GenesisMeter meter, Dictionary<UInt32, UInt32> checkAppsIdVersion, UInt32 Frequency, UInt32 MeterSize, Boolean PressurePresent)
{
currentMeter = meter;
var data = new List<IPickingResultData>();
data.Add(new PickingResultCustomCheckData(delegate
{
var r = meter.Login();
meter.SetProcessState(DisplayCodes.PickingStarted);
return new PickingItemCheckReturn { Result = true, Msg = "done" };
})
{ Index = data.Count, Ident = "Login", CheckText = "Try to access Meter", HasError = false, Result = null, CurrentValueText = "-" });
if (Frequency != 0)
{
data.Add(new PickingResultRegisterData { ReadMeter = meter, Index = data.Count, Ident = "Check Radio", CheckText = "433", CompareObject = Frequency, CurrentValueText = "none", HasError = false, Result = null, RegisterIdent = "SENSUSRADIO_FrequencyIndicator" }); ;
data.Add(new PickingResultRegisterData { ReadMeter = meter, Index = data.Count, Ident = "MeterSize", CheckText = "DN40-50", CompareObject = MeterSize, CurrentValueText = "none", HasError = false, Result = null, RegisterIdent = "GENESISFLOW_MeterSize" });
}
foreach (var item in checkAppsIdVersion)
{
data.Add(new PickingResultCustomCheckData(delegate
{
try
{
var MeterFWApp = meter.MeterAppListVersion.First(a => item.Key == a.AppId);
if (MeterFWApp == null || MeterFWApp.Version != item.Value)
{
return new PickingItemCheckReturn { Result = false, Msg = MeterFWApp.StrVersion };
}
return new PickingItemCheckReturn { Result = true, Msg = MeterFWApp.StrVersion };
}
catch (Exception)
{
return new PickingItemCheckReturn { Result = false, Msg = "error" };
}
})
{ Index = data.Count, Ident = $"Check AppId {item.Key}", CheckText = $"Version {item.Value}", HasError = false, Result = null, CurrentValueText = "-" }); ;
}
data.Add(new PickingResultCustomCheckData(delegate
{
try
{
meter.WriteRegister("METROLOGYASST_StoreConfiguration", 1);
Thread.Sleep(100);
var storeRet = meter.ReadRegister("METROLOGYASST_StoreConfiguration");
if (storeRet.All(a => a.Equals(0)))
{
return new PickingItemCheckReturn { Result = true, Msg = "Filesystem OK" };
}
return new PickingItemCheckReturn { Result = false, Msg = "Filesystem corrupt" };
}
catch (Exception)
{
return new PickingItemCheckReturn { Result = false, Msg = "error" };
}
})
{ Index = data.Count, Ident = "Check Filesystem", CheckText = "Check Filesystem", HasError = false, Result = null, CurrentValueText = "checking" }); ;
Status = OverallStatus.CheckingIsRunning;
ChangeDataData(data);
}
private void ChangeDataData(List<IPickingResultData> data)
{
Data = new ObservableCollection<IPickingResultData>(data);
OnDataChanged?.Invoke(Data, EventArgs.Empty);
}
public Boolean Run(String pcbID, String OrderNr)
{
var tmpData = Data.ToList();
foreach (var item in tmpData.Where(a => !a.Result.HasValue).OrderBy(a => a.Index))
{
var result = item.Action.Invoke();
item.Result = result.Result;
item.CurrentValueText = result.Msg;
ChangeDataData(tmpData);
}
if (tmpData.All(a => !a.HasError && a.Result.HasValue && a.Result.Value))
{
currentMeter.SetProcessState(DisplayCodes.PickingTested);
var url = $"{ServiceUrls.MeterProcessStateUrl()}SetPickingState?PcbID={pcbID}&FertigungsauftragsNr={OrderNr}";
var RetString = LocalWebRequest.PostRequestAsyncAndGetContent(url);
var result = false;
if (bool.TryParse(RetString, out result))
{
Status = OverallStatus.CheckingIsDone;
return result;
}
Status = OverallStatus.CheckingIsHasError;
return false;
}
currentMeter.SetProcessState(DisplayCodes.PickingFailed);
if (tmpData.All(a => a.HasError))
{
Status = OverallStatus.CheckingIsHasError;
}
else
{
Status = OverallStatus.CheckingIsNoMatch;
}
return false;
}
internal void Empty()
{
Status = OverallStatus.NoDetect;
ChangeDataData(new List<IPickingResultData>());
}
}
}

View File

@ -1,192 +0,0 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using Newtonsoft.Json;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
using Xylem.Common.Logic.ProductionOrderCore.ProcessState;
using Xylem.Common.Logic.ProductionOrderCore.TestResults;
using Xylem.Common.Logic.SoftwareAccessHelper;
using Xylem.Common.Production.ProductionUiCordonel.Data;
using Xylem.Common.Production.ProductionUiCordonel.Event;
namespace Xylem.Common.Production.ProductionUiCordonel.Model
{
public class PressureMultiModeViewModel : BaseMultiModeChildViewModel
{
public event EventHandler<StringArgs> OnStoreDone;
private PressureResultDataNotifyable result = new PressureResultDataNotifyable();
public PressureResultDataNotifyable Result
{
get => result;
set
{
result = value;
NotifyPropertyChanged();
}
}
private Boolean inputIsEnabled;
public Boolean InputIsEnabled
{
get => inputIsEnabled;
set
{
inputIsEnabled = value;
NotifyPropertyChanged();
}
}
public Boolean Locked { get; set; } = false;
public Int32? StationID { get; set; }
public PressureMultiModeViewModel(String ctrName, Int32 slotNR, List<String> barcodeTrigger, Int32? stationID = null) : base(ctrName, slotNR, barcodeTrigger, stationID)
{
VisibilityPressure = Visibility.Visible;
StationID = stationID;
}
public Boolean isHydraulicStaion()
{
if (!StationID.HasValue || StationID.Value == 1)
{
return false;
}
return true;
}
public override Boolean SlotIsLocked()
{
return false;
}
internal void ReloadData(Boolean reset)
{
if (Result != null && Result.PcbId != CurrentPcbID)
{
InputIsEnabled = false;
if (true)
{
}
Result = new PressureResultDataNotifyable { Remark = "loading", Testpoints = new ObservableCollection<PressureTestPoints>(), PcbId = "" };
Task.Run((Func<PressureResultDataNotifyable>)(() =>
{
try
{
var url = ServiceUrls.MeterProcessStateUrl();
url = url + $"GetPressureStateDetailed?PcbId={CurrentPcbID}&TopCount=1";
var retStr = LocalWebRequest.GetRequest(url);
var pressureResultData = JsonConvert.DeserializeObject<List<PressureResultData>>(retStr);
if (!pressureResultData.Any())
{
return new PressureResultDataNotifyable();
}
return new PressureResultDataNotifyable(pressureResultData.First());
}
catch (Exception ex)
{
Log(ex.Message);
return new PressureResultDataNotifyable();
}
})).ContinueWith(a =>
{
var res = a.Result;
res.PcbId = CurrentPcbID;
Result = res;
InputIsEnabled = true;
}
);
}
}
internal void StoreData(Boolean successfull)
{
if (Result != null && Result.PcbId == CurrentPcbID)
{
InputIsEnabled = false;
var isStored = false;
var status = DisplayCodes.PressureTestedFailed;
Task.Run((Action)(() =>
{
var url = ServiceUrls.MeterProcessStateUrl();
if (successfull)
{
status = DisplayCodes.PressureTested;
}
try
{
if (StationID == 1)
{
var addResult = new PressureTestResult
{
FreeText = Result.Remark,
Passed = successfull,
StationId = StationID
};
url = url + $"SetPressureState?PcbId={CurrentPcbID}&FertigungsauftragsNr=0";
if (!LocalWebRequest.PostRequestAsync(url, json: addResult))
{
throw new ApplicationException("PressureState: NOT successful");
}
}
else
{
url = url + "SetPressureStateDetailed";
var mutedResult = Result.ToBase();
isStored = LocalWebRequest.PostRequestAsync(url, json: mutedResult);
if (!isStored)
{
OnStoreDone?.Invoke(null, new StringArgs("Can not store Result"));
status = DisplayCodes.PressureTestedFailed;
}
}
CurrentMeter.Login();
CurrentMeter.SetProcessState(status);
}
catch (Exception ex)
{
Log(ex.Message);
status = DisplayCodes.PressureTestedFailed;
OnStoreDone?.Invoke(null, new StringArgs("Can not store Result"));
}
if (status == DisplayCodes.PressureTested)
{
OnStoreDone?.Invoke(null, new StringArgs("Pressure test stored successfully. Meter can passed"));
return;
}
OnStoreDone?.Invoke(null, new StringArgs("Pressure test stored successfully. But Meter is marked with a leakage. Please inform QS"));
}));
}
}
}
}

View File

@ -140,17 +140,6 @@
<Compile Include="..\..\.shared\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="ApplicationSettings.cs" />
<Compile Include="BarcodeInput\Listener.cs" />
<Compile Include="ctls\ctlMultiModeMarriage.xaml.cs">
<DependentUpon>ctlMultiModeMarriage.xaml</DependentUpon>
</Compile>
<Compile Include="ctls\ctlMultiModePicking.xaml.cs">
<DependentUpon>ctlMultiModePicking.xaml</DependentUpon>
</Compile>
<Compile Include="ctls\ctlMultiModePressure.xaml.cs">
<DependentUpon>ctlMultiModePressure.xaml</DependentUpon>
</Compile>
<Compile Include="Model\EOLHandler.cs" />
<Compile Include="ProductionProcesses\EolProcesses\CreateEolProgress.cs" />
<Compile Include="ProductionProcesses\EolProcesses\VisualInspection.cs" />
@ -173,16 +162,7 @@
<Compile Include="ProductionProcesses\PickingProcesses\PickingProcessStatesDef.cs" />
<Compile Include="ProductionProcesses\PickingProcesses\PrepareAssemblyRelease.cs" />
<Compile Include="ProductionProcesses\ProcessStateStruct.cs" />
<Compile Include="Data\PickingResultData.cs" />
<Compile Include="Data\PressureResultDataNotifyable.cs" />
<Compile Include="Event\StringArgs.cs" />
<Compile Include="Model\MultiModeMasterViewModel.cs" />
<Compile Include="Model\PressureMultiModeViewModel.cs" />
<Compile Include="Model\MultiModeChildViewModel.cs" />
<Compile Include="Model\MarriageMultiModeViewModel.cs" />
<Compile Include="Model\PickingMultiModeViewModel.cs" />
<Compile Include="Model\PickingViewModel.cs" />
<Compile Include="Model\IMultiModeChildViewModel.cs" />
<Compile Include="ProductionProcesses\EolProcesses\CheckSerialNumber.cs" />
<Compile Include="ProductionProcesses\EolProcesses\CheckOrderNumber.cs" />
<Compile Include="ProductionProcesses\EolProcesses\CheckAttachments.cs" />
@ -242,18 +222,6 @@
<Compile Include="UserControls\UcPasswordFile.xaml.cs">
<DependentUpon>UcPasswordFile.xaml</DependentUpon>
</Compile>
<Page Include="ctls\ctlMultiModeMarriage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ctls\ctlMultiModePicking.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ctls\ctlMultiModePressure.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ProductionWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

View File

@ -1,29 +0,0 @@
<UserControl x:Class="Xylem.Common.Production.ProductionUiCordonel.ctls.ctlMultiModeMarriage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="150" d:DesignWidth="450">
<Grid>
<StackPanel Background="BlanchedAlmond" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100*"/>
<ColumnDefinition Width="225*"/>
</Grid.ColumnDefinitions>
<TextBox Name="TxtSerialNumber" Text="{Binding SerialNr, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Height="26" Margin="24,10,0,0" TextWrapping="Wrap" IsEnabled="False" VerticalAlignment="Top" Width="190" Grid.Column="1" Grid.Row="0"/>
<Label Content="SerialNumber" HorizontalAlignment="Left" Margin="14,10,0,0" VerticalAlignment="Top" Grid.Row="0" Height="26" Width="82"/>
<TextBox x:Name="TxtPcbId" Text="{Binding CurrentPcbID, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Height="26" Margin="24,10,0,0" IsEnabled="False" TextWrapping="Wrap" VerticalAlignment="Top" Width="190" Grid.Column="1" Grid.Row="1"/>
<Label Content="PcbId" HorizontalAlignment="Left" Margin="14,10,0,0" VerticalAlignment="Top" Grid.Row="1" Height="26" Width="40"/>
<Button Name="btnMarry" IsEnabled="{Binding CanMarry, UpdateSourceTrigger=PropertyChanged}" Grid.ColumnSpan="2" Content="Marry" Height="35" Margin="35,5,0,0" Grid.Row="2" VerticalAlignment="Top" Click="btnMarry_Click" HorizontalAlignment="Left" Width="395"/>
</Grid>
</StackPanel>
</Grid>
</UserControl>

View File

@ -1,47 +0,0 @@
using System;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using Xylem.Common.Production.ProductionUiCordonel.Model;
using MessageBox = System.Windows.Forms.MessageBox;
namespace Xylem.Common.Production.ProductionUiCordonel.ctls
{
/// <summary>
/// Interaction logic for ctlMultiModeMarriage.xaml
/// </summary>
public partial class ctlMultiModeMarriage : UserControl
{
private MarriageMultiModeViewModel ViewModel;
public ctlMultiModeMarriage()
{
InitializeComponent();
}
public void setViewModel(MarriageMultiModeViewModel viewModel)
{
ViewModel = viewModel;
//ViewModel.Store();
}
private void btnMarry_Click(Object sender, RoutedEventArgs e)
{
Task.Run(() =>
{
return ViewModel.Store();
}).ContinueWith(a =>
{
if (a.Result)
{
MessageBox.Show("Meter has passed");
}
else
{
MessageBox.Show("Meter not has passed");
}
});
}
}
}

View File

@ -1,70 +0,0 @@
<UserControl x:Class="Xylem.Common.Production.ProductionUiCordonel.ctls.ctlMultiModePicking"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<StackPanel Background="BlueViolet" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="80*"/>
</Grid.ColumnDefinitions>
<Label Content="Picking Tool" Height="30" Grid.Row="0" Grid.ColumnSpan="2"></Label>
<Label Content="Order" Height="80" Grid.Row="1" Grid.Column="0"></Label>
<Label Name="lblPickingOrder" Height="80" Grid.Row="1" Grid.Column="1"></Label>
<Label Name="lblStatus" Height="80" Grid.Row="2" Grid.ColumnSpan="2"></Label>
</Grid>
<DockPanel>
<ItemsControl Name="icPicking" ItemsSource="{Binding Data}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border BorderBrush="Black" Background="{Binding ResultColor}" BorderThickness="1" Margin="2">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label Content="{Binding Ident}" Grid.Row="0" Grid.Column="0"/>
<Label Content="{Binding CheckText}" Grid.Row="0" Grid.Column="1"/>
<Label Content="{Binding CurrentValueText}" Grid.Row="0" Grid.Column="2"/>
<Label Content="{Binding Result}" Grid.Row="0" Grid.Column="3"/>
</Grid>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.Template>
<ControlTemplate TargetType="ItemsControl">
<ScrollViewer CanContentScroll="True">
<ItemsPresenter/>
</ScrollViewer>
</ControlTemplate>
</ItemsControl.Template>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</DockPanel>
</StackPanel>
</Grid>
</UserControl>

View File

@ -1,124 +0,0 @@
using System;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Threading;
using Xylem.Common.Production.ProductionUiCordonel.Data;
using Xylem.Common.Production.ProductionUiCordonel.Model;
namespace Xylem.Common.Production.ProductionUiCordonel.ctls
{
/// <summary>
/// Interaction logic for ctlMultiModePicking.xaml
/// </summary>
public partial class ctlMultiModePicking : UserControl
{
private PickingMultiModeViewModel ViewModel;
public ctlMultiModePicking()
{
InitializeComponent();
}
public void setViewModel(PickingMultiModeViewModel viewModel)
{
ViewModel = viewModel;
ViewModel.MeterDetectedHandler += ViewModel_MeterDetectedHandler;
viewModel.OnDataChanged += PickingData_OnDataChanged;
ViewModel.OnUpdateUi += UpdatePickingUi;
}
private void ViewModel_MeterDetectedHandler(Object sender, EventArgs e)
{
Dispatcher.Invoke(DispatcherPriority.Normal,
new Action(() =>
{
Boolean update = false;
if (sender is null)
{
ViewModel.InputIsEnabled = false;
}
else
{
var ts = DateTimeOffset.UtcNow - new DateTimeOffset(2000, 1, 1, 0, 0, 0, new TimeSpan(0));
ViewModel.CurrentMeter.Login();
ViewModel.CurrentMeter.WriteRegister("GENESISFLOW_SealDisplay", 0);
ViewModel.CurrentMeter.WriteRegister("POWERMON_WarnFromClamp", (UInt32)473040000);
ViewModel.CurrentMeter.WriteRegister("SYSTEM_CalendarSeconds", Convert.ToInt32(ts.TotalSeconds));
ViewModel.CurrentMeter.SetLcdText(false, new Byte[] { 0x12, 0x34 });
//ViewModel.ReloadData(false);
}
}
));
}
private void UpdatePickingUi(Object sender, EventArgs e)
{
icPicking.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
{
lblStatus.Content = ViewModel.StatusText;
lblStatus.Background = ViewModel.StatusColor;
lblPickingOrder.Content = $"{ViewModel.Order}({ViewModel.Done}/{ViewModel.ToDo}";
if (ViewModel.Done > 0 && ViewModel.Done >= ViewModel.ToDo)
{
MessageBox.Show("Order is Finish");
lblStatus.Content = "Please input a new order number";
}
}));
}
private void PickingData_OnDataChanged(Object sender, EventArgs e)
{
if (sender is ObservableCollection<IPickingResultData> newData)
{
icPicking.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => { icPicking.ItemsSource = newData; }));
}
icPicking.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => { lblStatus.Content = ViewModel.StatusText; lblStatus.Background = ViewModel.StatusColor; }));
}
//private void UpdatePickingUi(string state, System.Windows.Media.Brush StateColor, string Order, int toDo, int Done)
//{
// icPicking.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
// {
// lblStatus.Content = state;
// lblStatus.Background = StateColor;
// lblPickingOrder.Content = $"{Order}({Done}/{toDo}";
// txtHiddenInput.Focus();
// if (Done > 0 && Done >= toDo)
// {
// MessageBox.Show("Order is Finish");
// txtOrderNr.Text = "";
// lblStatus.Content = "Please input a new order number";
// }
// }));
//}
//private void PickingData_OnDataChanged(object sender, EventArgs e)
//{
// if (sender is ObservableCollection<IPickingResultData> newData)
// {
// icPicking.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => { icPicking.ItemsSource = newData; }));
// }
// icPicking.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => { lblStatus.Content = PickingData.StatusText; lblStatus.Background = PickingData.StatusColor; }));
//}
}
}

View File

@ -1,150 +0,0 @@
<UserControl x:Class="Xylem.Common.Production.ProductionUiCordonel.ctls.ctlMultiModePressure"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="600" Background="CadetBlue" IsEnabled="{Binding InputIsEnabled, UpdateSourceTrigger=PropertyChanged}" >
<Grid>
<!--<Grid Grid.Row="8">
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
<RowDefinition Height="5*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="5*"/>
<RowDefinition Height="10*" />
<RowDefinition Height="30*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="5*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="65"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Rectangle Grid.Row="0" Grid.ColumnSpan="2" Fill="Transparent" />
<Rectangle Grid.Row="1" Grid.ColumnSpan="2" Fill="Black" />
<Rectangle Grid.Row="2" Grid.ColumnSpan="2" Fill="LightGreen" />
<Rectangle Grid.Row="3" Grid.ColumnSpan="2" Fill="LightGreen" />
<Rectangle Grid.Row="4" Grid.ColumnSpan="2" Fill="Black" />
<Rectangle Grid.Row="5" Grid.ColumnSpan="2" Fill="LightPink" />
<Rectangle Grid.Row="6" Grid.ColumnSpan="2" Fill="LightPink" />
<Rectangle Grid.Row="7" Grid.ColumnSpan="2" Fill="LightPink" />
<Rectangle Grid.Row="8" Grid.ColumnSpan="2" Fill="Black" />
<TextBox x:Name="TxtPresurePcbId" HorizontalAlignment="Left" Height="26" Margin="0,0,0,0" IsEnabled="False" TextWrapping="Wrap" Text="{Binding CurrentPcbID, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Width="268" Grid.Row="0" Grid.Column="1"/>
<Label Content="PcbId" HorizontalAlignment="Left" Margin="0,10,0,0" VerticalAlignment="Top" Grid.Row="0" Height="26" Width="40"/>
<Label Content="Presue was successful" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" HorizontalAlignment="Left" Width="630" />
<Button Name="btnPresueOk" Grid.ColumnSpan="2" Content="Pressure test successful" HorizontalAlignment="Left" Height="35" Margin="9,5,0,0" Grid.Row="3" VerticalAlignment="Top" Width="435" Click="BtnPresueOk_Click"/>
<Label Content="Presue Failed" HorizontalAlignment="Left" Width="630" Grid.Column="0" Grid.Row="5" Grid.ColumnSpan="2" />
<Label Content="Remark" HorizontalAlignment="Left" Margin="0,10,0,0" VerticalAlignment="Top" Height="26" Width="54" Grid.Column="0" Grid.Row="6" />
<TextBox x:Name="TxtPresureFailedText" HorizontalAlignment="Left" Height="102" Margin="3,10,0,0" TextWrapping="Wrap" AcceptsReturn="True" AcceptsTab="True" SpellCheck.IsEnabled="True" SpellCheck.SpellingReform="PreAndPostreform" Text="" VerticalAlignment="Top" Width="478" Grid.Row="6" Grid.Column="1"/>
<Button Name="btnPresueFailed" Grid.ColumnSpan="2" Content="Pressure test was unsuccessful" HorizontalAlignment="Left" Height="35" Margin="9,5,0,0" Grid.Row="7" VerticalAlignment="Top" Width="435" Click="BtnPresueFailed_Click" />
</Grid>-->
<Grid Grid.Row="8">
<Grid.RowDefinitions>
<RowDefinition Height="12*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="100*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="20*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120" />
<ColumnDefinition Width="180" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="200" />
</Grid.ColumnDefinitions>
<Label x:Name="lblHeadline" Content="HE-Schnüffeln" Grid.Column="0" Grid.Row="0" FontWeight="Bold" FontSize="24" Height="47" VerticalAlignment="Top" Margin="0,0,113,0" Grid.RowSpan="2" Grid.ColumnSpan="2" />
<Label x:Name="lblLeakrate" Content="Grenz-Leckrate >" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Grid.Row="0" Grid.Column="2" Height="26" Width="123" />
<TextBox x:Name="txtLeakrate" Height="26" IsEnabled="True" TextWrapping="Wrap" Text="{Binding Result.LeakRate, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Grid.Row="0" Grid.Column="3" HorizontalAlignment="Left" Width="171" TextChanged="TextBox_TextChanged"/>
<TextBox x:Name="TxtPresurePcbId" Height="26" IsEnabled="False" TextWrapping="Wrap" Text="{Binding CurrentPcbID, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" Width="150" TextChanged="TextBox_TextChanged"/>
<Label Content="PcbId" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Grid.Row="1" Grid.Column="0" Height="26" Width="40"/>
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="2">
<TextBlock Text="Rev: "/>
<Label Content="{Binding Result.Rev, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" VerticalAlignment="Top" Height="26" Width="40"/>
</StackPanel>
<Label Content="Prüfdruck in bar" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Grid.Row="2" Grid.Column="0" Height="26" Width="113" Grid.ColumnSpan="2" />
<TextBox x:Name="txtPressure" Height="26" IsEnabled="True" TextWrapping="Wrap" Text="{Binding Result.TestPressure, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" Width="150" TextChanged="TextBox_TextChanged"/>
<TextBox x:Name="txtTester" Height="26" IsEnabled="True" TextWrapping="Wrap" Text="{Binding Result.TesterName, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left" Width="150" TextChanged="TextBox_TextChanged" />
<Label Content="Prüfer" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Grid.Row="3" Grid.Column="0" Height="26" Width="85" />
<ListView x:Name="listViewTestPotins" ItemsSource="{Binding Result.Testpoints, UpdateSourceTrigger=PropertyChanged}" Grid.Row="2" Grid.Column="2" Grid.RowSpan="4" HorizontalAlignment="left" Width="251" Margin="10,10,0,0" Grid.ColumnSpan="2" >
<ListView.View>
<GridView >
<GridViewColumn Header="Nr" >
<GridViewColumn.CellTemplate>
<DataTemplate >
<Label Content="{Binding Ident}" Height="22" FontWeight="Bold" FontSize="10" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Wert" >
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Input}" Height="22" Width="100" FontWeight="Bold" FontSize="13" TextChanged="TextBox_TextChanged" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="" >
<GridViewColumn.CellTemplate>
<DataTemplate>
<Button Content="Für alle übernehmen" Height="22" FontWeight="Bold" FontSize="13" Click="Button_Click" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
<Label Content="Bemerkung" HorizontalAlignment="Left" Margin="0,10,0,0" VerticalAlignment="Top" Height="26" Width="113" Grid.Column="0" Grid.Row="4" Grid.ColumnSpan="2" />
<TextBox Text="{Binding Result.Remark, UpdateSourceTrigger=PropertyChanged}" Margin="10,10,10,7" TextWrapping="Wrap" AcceptsReturn="True" AcceptsTab="True" SpellCheck.IsEnabled="True" SpellCheck.SpellingReform="PreAndPostreform" Grid.Row="4" Grid.Column="1" TextChanged="TextBox_TextChanged"/>
<Button Name="btnPresueOk" Background="LightGreen" Grid.ColumnSpan="2" Content="Bestanden" HorizontalAlignment="Left" Height="35" Margin="10,5,0,0" Grid.Row="6" VerticalAlignment="Top" Width="280" Click="BtnPresueOk_Click" Grid.Column="2"/>
<Button Name="btnPresueFailed" Background="LightPink" Grid.ColumnSpan="2" Content="Nicht Bestanden" HorizontalAlignment="Left" Height="35" Margin="9,5,0,0" Grid.Row="6" VerticalAlignment="Top" Width="281" Click="BtnPresueFailed_Click" Grid.Column="0" />
</Grid>
</Grid>
</UserControl>

View File

@ -1,168 +0,0 @@
using System;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Threading;
using Xylem.Common.Logic.ProductionOrderCore.TestResults;
using Xylem.Common.Production.ProductionUiCordonel.Event;
using Xylem.Common.Production.ProductionUiCordonel.Model;
namespace Xylem.Common.Production.ProductionUiCordonel.ctls
{
/// <summary>
/// Interaction logic for ctlMultiModePressure.xaml
/// </summary>
public partial class ctlMultiModePressure : UserControl
{
public event EventHandler<StringArgs> OnBarcodeInput;
private PressureMultiModeViewModel ViewModel;
public ctlMultiModePressure()
{
InitializeComponent();
}
public void setViewModel(PressureMultiModeViewModel viewModel)
{
ViewModel = viewModel;
viewModel.MeterDetectedHandler += ViewModel_MeterDetectedHandler;
ViewModel.OnStoreDone += ViewModel_OnStoreDone;
//OnBarcodeInput = "PressureControl_OnBarcodeInput"
//
if (viewModel.ChildName == "PressureHY")
{
ViewModel.StationID = 1;
lblHeadline.Content = "hydraulisch Dichtheitsprüfung";
txtLeakrate.Visibility = Visibility.Hidden;
lblLeakrate.Visibility = Visibility.Hidden;
listViewTestPotins.Visibility = Visibility.Hidden;
}
else
{
ViewModel.StationID = 2;
lblHeadline.Content = "Helium Dichtheitsprüfung";
}
}
private void ViewModel_MeterDetectedHandler(Object sender, EventArgs e)
{
Dispatcher.Invoke(DispatcherPriority.Normal,
new Action(() =>
{
Boolean update = false;
if (sender is null)
{
ViewModel.InputIsEnabled = false;
}
else
{
ViewModel.ReloadData(false);
}
}
));
}
private void BtnPresueOk_Click(Object sender, RoutedEventArgs e)
{
ViewModel.StoreData(true);
}
private void BtnPresueFailed_Click(Object sender, RoutedEventArgs e)
{
ViewModel.StoreData(false);
}
private void ViewModel_OnStoreDone(Object sender, StringArgs e)
{
MessageBox.Show(e.Content);
}
private Int32? BarcodeInputActiveOffset;
private String BarcodeInput = "";
private void TextBox_TextChanged(Object sender, TextChangedEventArgs e)
{
if (sender is TextBox txtSender)
{
var c = e.Changes.First();
if (c.RemovedLength == 0)
{
var input = txtSender.Text.Substring(c.Offset, c.AddedLength);
if (BarcodeInputActiveOffset.HasValue)
{
BarcodeInput = $"{BarcodeInput}{input}";
if (input == Environment.NewLine)
{
var tmpOffset = BarcodeInputActiveOffset.Value;
BarcodeInputActiveOffset = null;
//OnBarcodeInput?.Invoke(null, new StringArgs(BarcodeInput));
txtSender.Text = txtSender.Text.Replace(BarcodeInput, "");
BarcodeInput = "";
txtSender.Focus();
txtSender.CaretIndex = tmpOffset;
}
}
else
{
if (ViewModel != null && ViewModel.BarcodeTrigger.Any(t => t == input))
{
BarcodeInput = txtSender.Text.Substring(c.Offset, c.AddedLength);
BarcodeInputActiveOffset = c.Offset;
}
}
}
}
}
private void Button_Click(Object sender, RoutedEventArgs e)
{
String input = "";
var obj = ((FrameworkElement)sender).DataContext;
if (obj is PressureTestPoints ptp)
{
ViewModel.Result.SetAllTestPoints(ptp.Input);
}
var d = listViewTestPotins.DataContext;
listViewTestPotins.DataContext = null;
listViewTestPotins.DataContext = d;
// var c = e.Changes.First();
// if (c.RemovedLength == 0)
// {
// var input = txtSender.Text.Substring(c.Offset, c.AddedLength);
// if (BarcodeInputActiveOffset.HasValue)
// {
// BarcodeInput = $"{BarcodeInput}{input}";
// if (input == System.Environment.NewLine)
// {
// var tmpOffset = BarcodeInputActiveOffset.Value;
// BarcodeInputActiveOffset = null;
// OnBarcodeInput?.Invoke(null, new StringArgs(BarcodeInput));
// txtSender.Text = txtSender.Text.Replace(BarcodeInput, "");
// BarcodeInput = "";
// txtSender.Focus();
// txtSender.CaretIndex = tmpOffset;
// }
// }
// else
// {
// if (ViewModel != null && ViewModel.BarcodeTrigger.Any(t => t == input))
// {
// BarcodeInput = txtSender.Text.Substring(c.Offset, c.AddedLength);
// BarcodeInputActiveOffset = c.Offset;
// }
// }
// }
//}
}
}
}

View File

@ -833,7 +833,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
var startInex = St.IndexOf("\"StartDT\":\"") + "\"StartDT\":\"".Length;
var datestring = St.Substring(startInex, "29.07.2022 06:47:27".Length);
lastProdDate = DateTime.ParseExact(datestring, "dd.MM.yyyy hh:mm:ss", CultureInfo.CreateSpecificCulture("de-DE"));
lastProdDate = DateTime.ParseExact(datestring, "dd.MM.yyyy HH:mm:ss", CultureInfo.CreateSpecificCulture("de-DE"));
}

View File

@ -1,12 +1,20 @@
using Oracle.ManagedDataAccess.Client;
using LaaPackages.Features.Cordonel.Models;
using Newtonsoft.Json.Linq;
using Oracle.ManagedDataAccess.Client;
using Service.MeterProcessState;
using Service.MeterProcessState.Data;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web.Helpers;
using System.Web.Http;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers.Json;
using Xylem.Common.Logic.ServiceCore;
@ -121,7 +129,105 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
return Request.CreateResponse(HttpStatusCode.InternalServerError, ex.ToString() + "<br >" + ex.InnerException.ToString());
}
}
[Route("SyncKitronData")]
public async Task<HttpResponseMessage> SyncKitronData()
{
StringBuilder query = new StringBuilder();
query.AppendLine("SELECT TOP (1) ID, Jobname, ActionDate, DoneDate, LastID, DataCount FROM KitronSync where DoneDate is null order by ID ");
using (var dataAccess = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var dt = dataAccess.ExecuteQuery(query.ToString());
foreach (DataRow item in dt.Rows)
{
var LastID = (int)item["LastID"];
var DataCount = (int)item["DataCount"];
var UpdateTillLasID = LastID + DataCount;
var kitronFinals = dataAccess.ExecuteQuery($" sELECT * FROM OPENQUERY (MyOraDB, ' SELECT DS_ID,ID_PCB,ID_TEST,JSON FROM DELTACHEF.GENESIS_PCBFUNCTIONALTEST_PD WHERE DS_ID >= {LastID + 1} and DS_ID <= {LastID+ 1 + DataCount} order by DS_ID asc ');");
foreach (DataRow kitronItem in kitronFinals.Rows)
{
try
{
var DS_ID = (double)kitronItem["DS_ID"];
var ID_PCB = kitronItem["ID_PCB"].ToString();
var ID_TEST = (double)kitronItem["ID_TEST"];
var JSON = kitronItem["JSON"].ToString();
var oo = JObject.Parse(JSON);
UpdateTillLasID = (int)DS_ID;
var TestResultPass = false;
var IrDALogonSkeleton = "";
var FWVersion = "";
var MaterialNumber = "";
var StartDT = DateTime.MinValue;
foreach (var oItem in oo.Children().Values())
{
foreach (JProperty ChildValues in oItem.Children())
{
switch (ChildValues.Name)
{
case "TestResult":
TestResultPass = (ChildValues.Value.ToString().ToUpper() == "PASS");
break;
case "IrDA Logon Skeleton":
IrDALogonSkeleton = ChildValues.Value.ToString();
break;
case "FW Version":
FWVersion = ChildValues.Value.ToString();
break;
case "MaterialNumber":
MaterialNumber = ChildValues.Value.ToString();
break;
case "StartDT":
DateTime.TryParseExact(ChildValues.Value.ToString(), "dd.MM.yyyy HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal, out StartDT);
break;
default:
break;
}
}
}
if (TestResultPass)
{
int matr = -1;
string remark = "";
if (!int.TryParse(MaterialNumber, out matr))
{
matr = -1;
remark = MaterialNumber;
}
dataAccess.ExecuteQuery($"" +
$" IF not EXISTS (SELECT 1 FROM dbo.[Cordonel_KitronData] WHERE KitronDSId = {DS_ID}) " +
$" Begin" +
$" INSERT INTO [dbo].[Cordonel_KitronData] ([PcbId] ,[KitronDSId] ,[Skeleton] ,[FW] ,[MaterialNumber] ,[ProdDate], [Remark]) " +
$" VALUES ( {ID_PCB},{DS_ID}, '{IrDALogonSkeleton}','{FWVersion}', {matr} , '{StartDT.ToString("yyyyMMdd HH:mm:ss")}', '{remark}')" +
$" end");
}
}
catch (Exception ex)
{
throw;
}
}
dataAccess.ExecuteQuery($"Update [dbo].KitronSync set LastID = {UpdateTillLasID} ");
}
}
return Request.CreateResponse(HttpStatusCode.OK, await Task.Run(() => { return true; }));
}
[Route("GetProddate")]
public async Task<HttpResponseMessage> GetProddate(string Seriennumer = "")
{
@ -145,7 +251,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
// create connection
@ -173,7 +279,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
var St = ((string)reader["JSON"]);
var startInex = St.IndexOf("\"StartDT\":\"") + "\"StartDT\":\"".Length;
var datestring = St.Substring(startInex, "29.07.2022 06:47:27".Length);
DateTime.ParseExact(datestring, "dd.MM.yyyy hh:mm:ss", CultureInfo.InvariantCulture);
DateTime.ParseExact(datestring, "dd.MM.yyyy HH:mm:ss", CultureInfo.InvariantCulture);

View File

@ -115,7 +115,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
else
{
retC.kitronDate = DateTime.ParseExact(datestring, "dd.MM.yyyy hh:mm:ss", CultureInfo.InvariantCulture);
retC.kitronDate = DateTime.ParseExact(datestring, "dd.MM.yyyy HH:mm:ss", CultureInfo.InvariantCulture);
}

View File

@ -2,7 +2,7 @@
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<NameOfLastUsedPublishProfile>E:\REPO\lab\la_operations\laa_production\Common\Service\MeterProcessState\Properties\PublishProfiles\IISProfile.pubxml</NameOfLastUsedPublishProfile>
<NameOfLastUsedPublishProfile>E:\REPO\lab\la_operations\laa_production\Common\Service\MeterProcessState\Properties\PublishProfiles\a.pubxml</NameOfLastUsedPublishProfile>
<UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress />
<IISExpressSSLPort />

View File

@ -303,7 +303,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
MeterPwdDb _pwdContainer = new MeterPwdDb();
var ret = MeterPwdHandlerDb.RequestPwdFileFromDb(_currentGenesis.GetPcbId(), out _pwdContainer);
//
if (_currentGenesis.Login(_pwdContainer.Skeleton))
{

@ -1 +1 @@
Subproject commit ffa0abaa0448ba22350982cd3d3560ce1eaab42a
Subproject commit 3a9b1c5d5ef1f05b68ff2c0f849f79b56bd44945