After FAI

This commit is contained in:
Roland Drabesch
2022-09-22 16:07:58 +02:00
parent 8472b242ee
commit e293fc408e
39 changed files with 1261 additions and 401 deletions
+1 -1
View File
@@ -155,7 +155,7 @@
</site>
<site name="MeterProcessState" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="D:\Projekte\SENSUS_GitLab\laa_production\Common\Service\MeterProcessState" />
<virtualDirectory path="/" physicalPath="C:\Users\drabesch_ro\Repo\lab\la_operations\laa_production\Common\Service\MeterProcessState" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:56011:localhost" />
+1 -1
View File
@@ -6,7 +6,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:CordonelAssemblyLine"
mc:Ignorable="d"
Title="Leak" Height="450" Width="800" Background="Aqua">
Title="Leak" Height="450" Width="800" Background="Aqua" Closing="Window_Closing">
<Window.Resources>
<c:MathConverter x:Key="myMathConverter"/>
</Window.Resources>
+5
View File
@@ -110,5 +110,10 @@ namespace CordonelAssemblyLine
//}
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
ViewModel.Dispose();
this.Title = "";
}
}
}
+4 -4
View File
@@ -7,7 +7,7 @@
xmlns:ProductionControls="clr-namespace:ProductionControls;assembly=ProductionControls"
xmlns:ProductionControls1="clr-namespace:Ui.ProductionControls;assembly=ProductionControls"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
Title="MainWindow" Height="450" Width="800" Closing="Window_Closing">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
@@ -22,9 +22,9 @@
<ColumnDefinition Width="217*"/>
</Grid.ColumnDefinitions>
<Button Content="Picking" HorizontalAlignment="Left" Height="80" Margin="34,10,0,0" VerticalAlignment="Top" Width="220" Click="Button_Click"/>
<Button Content="Leak" HorizontalAlignment="Left" Height="80" Margin="34,10,0,0" VerticalAlignment="Top" Width="220" Click="Button_Click_1" Grid.Row="1"/>
<Button Content="Marrieage" HorizontalAlignment="Left" Height="80" Margin="34,10,0,0" VerticalAlignment="Top" Width="220" Click="Button_Click_2" Grid.Row="2"/>
<Button Content="Kommissionierung/Picking" HorizontalAlignment="Left" Height="80" Margin="34,10,0,0" VerticalAlignment="Top" Width="220" Click="Button_Click"/>
<Button Content="Helium Prüfung/Leak" HorizontalAlignment="Left" Height="80" Margin="34,10,0,0" VerticalAlignment="Top" Width="220" Click="Button_Click_1" Grid.Row="1"/>
<Button Content="Verheiraten/Marrieage" HorizontalAlignment="Left" Height="80" Margin="34,10,0,0" VerticalAlignment="Top" Width="220" Click="Button_Click_2" Grid.Row="2"/>
<TextBox Name="txtPickingBarcode" Grid.Column="2" HorizontalAlignment="Left" Height="23" Margin="10,41,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
<TextBox Name="txtPickingSlot" Grid.Column="1" HorizontalAlignment="Left" Height="23" Margin="10,41,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
<Label Content="Slot" Grid.Column="1" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Height="26" Width="30"/>
@@ -45,6 +45,11 @@ namespace CordonelAssemblyLine
private void Button_Click(object sender, RoutedEventArgs e)
{
if (PickingWindow?.Title == "")
{
PickingWindow = null;
}
if (PickingWindow == null)
{
var tmp = 0;
@@ -54,12 +59,20 @@ namespace CordonelAssemblyLine
PickingWindow.Show();
}
}
else
{
PickingWindow.Focus();
}
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
if (LeakWindow?.Title == "")
{
LeakWindow = null;
}
if (LeakWindow == null)
{
var tmpSlot = 0;
@@ -70,10 +83,18 @@ namespace CordonelAssemblyLine
LeakWindow.Show();
}
}
else
{
LeakWindow.Focus();
}
}
private void Button_Click_2(object sender, RoutedEventArgs e)
{
if (MarriageWindow?.Title == "")
{
MarriageWindow = null;
}
if (MarriageWindow == null)
{
var tmp = 0;
@@ -84,6 +105,10 @@ namespace CordonelAssemblyLine
}
}
else
{
MarriageWindow.Focus();
}
}
private System.Collections.Generic.List<Ui.ProductionControls.ctlPictureProgressBar.ImageElement> progressbars = new System.Collections.Generic.List<Ui.ProductionControls.ctlPictureProgressBar.ImageElement>();
@@ -113,5 +138,25 @@ namespace CordonelAssemblyLine
progressbars.Where(n => n.Name == el3).First().State = Ui.ProductionControls.Enums.ImgStatus.InProgress;
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if (PickingWindow != null)
{
PickingWindow.Close();
}
if (LeakWindow != null)
{
LeakWindow.Close();
}
if (MarriageWindow != null)
{
MarriageWindow.Close();
}
}
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:CordonelAssemblyLine"
mc:Ignorable="d"
Title="Marriage" Height="287.361" Width="489.32" Loaded="Window_Loaded">
Title="Marriage" Height="287.361" Width="489.32" Loaded="Window_Loaded" Closing="Window_Closing">
<Grid>
<StackPanel Background="BlanchedAlmond" >
@@ -51,5 +51,11 @@ namespace CordonelAssemblyLine
{
Model.StartStore();
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
Model.Dispose();
this.Title = "";
}
}
}
@@ -348,6 +348,8 @@ namespace CordonelAssemblyLine.Model
url = url + $"SetPressureStateDetailed";
var mutedResult = Result.ToBase();
mutedResult.Passed = successfull;
isStored = LocalWebRequest.PostRequestAsync(url, json: mutedResult);
if (!isStored)
{
@@ -8,6 +8,7 @@ using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Xylem.Common.CommonCore.Configuration;
@@ -148,15 +149,25 @@ namespace CordonelAssemblyLine.Model
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
Task s;
private bool CloseTask = false;
public void Dispose()
{
while (!s.IsCompleted)
{
CloseTask = true;
}
}
public void StartStore()
{
sm = PickingStateMachine.Store;
}
public void StartPicking(CancellationToken cancle)
{
var s = new Task(() => { PickingLoop(cancle); }, cancle);
s = new Task(() => { PickingLoop(cancle); }, cancle);
s.Start();
}
public enum PickingStateMachine
@@ -169,7 +180,8 @@ namespace CordonelAssemblyLine.Model
Store,
WaitForBuildingMeterReady,
MappingError,
Done
Done,
GetMappingMSG
}
private PickingStateMachine sm = PickingStateMachine.Init;
@@ -363,13 +375,15 @@ namespace CordonelAssemblyLine.Model
private string serialNr;
private bool RequestDetails = false;
private readonly string ScannerPort;
private readonly int SlotNr;
//PickingState,PickingScanner,PickingSlot,PickingResult
private void PickingLoop(CancellationToken token)
{
while (!token.IsCancellationRequested)
while (!token.IsCancellationRequested && !CloseTask)
{
switch (sm)
{
@@ -404,15 +418,37 @@ namespace CordonelAssemblyLine.Model
break;
case PickingStateMachine.WaitForScanning:
OrderDetails = null;
State = $"Warte auf Scannereingabe({ScannerPort})";
if (barScanner != null && !String.IsNullOrEmpty(barScanner.Input))
{
if (RequestDetails)
{
State = $"Abfrage ";
PcbId = barScanner.Input;
barScanner.Input = "";
sm = PickingStateMachine.GetMappingMSG;
}
else
{
if (barScanner.Input.Contains("%RequestMapping%"))
{
RequestDetails = true;
State = $"PCB ID scannen!";
barScanner = new BarScanner(ScannerPort, token);
barScanner.Start();
}
else
{
SerialNr = barScanner.Input;
Scanner = $"Geschlossen {ScannerPort}";
barScanner = null;
sm = PickingStateMachine.WaitForDetect;
}
}
}
break;
case PickingStateMachine.WaitForDetect:
@@ -452,6 +488,73 @@ namespace CordonelAssemblyLine.Model
}
}
break;
case PickingStateMachine.GetMappingMSG:
State = $"Lade Auftragsdaten {serialNr}";
var msgRetCode = 0;
var msgStr = LocalWebRequest.GetRequestWithError($"{ServiceUrls.MarriageServiceUrl()}GetPreMarriageStateMSG?PcbId={PcbId}", out msgRetCode, 15000);
var msgRetInt = MarriagePossibleEnum.None;
var sbMSG = new StringBuilder();
var myJsonResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<object[]>(msgStr);
string retOrder = myJsonResponse[1]?.ToString();
string retSerial = myJsonResponse[2]?.ToString();
string retFreeSrn = myJsonResponse[3]?.ToString();
sbMSG.AppendLine($"Abfrage");
sbMSG.AppendLine($"PCB Id: \t \t \t \t {PcbId}");
sbMSG.AppendLine($"Aufrag: \t \t \t \t {retOrder}");
sbMSG.AppendLine($"Seriennummer: \t \t \t \t {retSerial}");
sbMSG.AppendLine($"Noch Verfügbare Seriennummern des Auftrages: \t {retFreeSrn}");
sbMSG.AppendLine($"Zusätzliche Infos:");
if (msgRetCode != 200 || !MarriagePossibleEnum.TryParse(myJsonResponse[0].ToString(), out msgRetInt))
{
sbMSG.AppendLine($"Technisches Problem beim abfragen der Verfügbarkeit. Code ({msgRetCode})");
}
if (msgRetInt.HasFlag(MarriagePossibleEnum.NotPossibleDueAlredayMatch))
{
sbMSG.AppendLine($"Pcb ist schon mit der Seriennummer {retSerial} verbunden");
}
if (msgRetInt.HasFlag(MarriagePossibleEnum.NotPossibleDuePcblocked))
{
sbMSG.AppendLine("Pcb ist schon mit einer anderen Seriennummer verbunden.");
}
if (msgRetInt.HasFlag(MarriagePossibleEnum.NotPossibleDueSerialNumberBlocked))
{
sbMSG.AppendLine("Seriennummer ist schon mit einer anderen Pcb verbunden.");
}
if (msgRetInt.HasFlag(MarriagePossibleEnum.PcbNotMatchingOrder))
{
sbMSG.AppendLine("Die Pcb ist noch keinem Auftrag zugeordnet.");
}
if (msgRetInt.HasFlag(MarriagePossibleEnum.Error))
{
sbMSG.AppendLine("Ein unbestimmter Fehler ist aufgetreten.");
}
if (msgRetInt.HasFlag(MarriagePossibleEnum.NotPossibleDueNoPressureTestFound))
{
sbMSG.AppendLine("Druck Test fehlt");
}
if (msgRetInt.HasFlag(MarriagePossibleEnum.NotPossibleDueNoHeTestFound))
{
sbMSG.AppendLine("Heliumtest fehlt");
}
if (msgRetInt.HasFlag(MarriagePossibleEnum.Possible))
{
sbMSG.AppendLine("Verheiraten möglich");
}
OnMsgRaise?.Invoke(this, sbMSG.ToString());
sm = PickingStateMachine.WaitForScanning;
Log($"No Meter found");
break;
case PickingStateMachine.GetMapping:
@@ -524,6 +627,15 @@ namespace CordonelAssemblyLine.Model
{
MappingText.Add("Ein unbestimmter Fehler ist aufgetreten.");
}
if (retInt.HasFlag(MarriagePossibleEnum.NotPossibleDueNoPressureTestFound))
{
MappingText.Add("Druck Test fehlt");
}
if (retInt.HasFlag(MarriagePossibleEnum.NotPossibleDueNoHeTestFound))
{
MappingText.Add("Heliumtest fehlt");
}
if (MappingText.Any())
@@ -258,14 +258,14 @@ namespace CordonelAssemblyLine.Model
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
Task s;
public void StartPicking(CancellationToken cancle, string scannerPort, int slotNr)
{
ScannerPort = scannerPort;
SlotNr = slotNr;
var s = new Task(() => { PickingLoop(cancle); }, cancle);
CloseTask = false;
s = new Task(() => { PickingLoop(cancle); }, cancle);
s.Start();
}
public enum PickingStateMachine
@@ -358,7 +358,17 @@ namespace CordonelAssemblyLine.Model
State = state;
UpdateLogText($"Status:{State}");
}
private bool CloseTask = false;
public void Dispose()
{
while (!s.IsCompleted)
{
CloseTask = true;
}
}
public bool Compare(Dictionary<UInt32, UInt32> checkAppsIdVersion, uint Frequency, uint MeterSize, bool PressurePresent)
{
using (var Batch = new MeterBatch())
@@ -386,6 +396,42 @@ namespace CordonelAssemblyLine.Model
lblS08Color = progressError;
ret = false;
}
var nowSeconds = meter.ReadRegister("POWERMON_TotalUsedSeconds");
var nowCharge = meter.ReadRegister("POWERMON_TotalUsedCharge", 8);
var mfgCharge = meter.ReadRegister("CUSTOMER_MfgCharge");
if (nowCharge == null || nowSeconds == null)
{
meter.WriteLog($"Batterie nicht lesbar");
lblS08Text = $"Batterie nicht lesbar";
lblS08Color = progressError;
ret = false;
}
else
{
var nowChargeV = BitConverter.ToUInt64(nowCharge.ToArray(), 0);
var nowSecondsV = BitConverter.ToUInt32(nowSeconds.ToArray(), 0);
var mfgChargeV = BitConverter.ToUInt32(mfgCharge.ToArray(), 0);
//// Time Span in h in mAhr In % with one battery is 100%
////(((total used change difference / (Time span / 3600) ) / 3600000) / 19000)*100
var loadAtH = ((((double)nowChargeV / ((double)nowSecondsV / 3600)) / 3600000) / (19000 * 2)) * 100;
var totalUsed = (((double)nowChargeV / 1000000 / 3.6) / ((19000 * 2))) * 100;
setState($"Battery Total Used {totalUsed}%");
setState($"Battery Total Charge {nowChargeV}uAs");
setState($"Battery MFG Charge {mfgChargeV}uAs");
if (totalUsed >= 5.0)
{
lblS08Text = $"Batterie über 5%";
lblS08Color = progressError;
ret = false;
}
}
}
if (SkipProcessSteps == null || !SkipProcessSteps.SkipLUT)
@@ -433,7 +479,7 @@ namespace CordonelAssemblyLine.Model
{
setState($"Vergleich abgeschlossen:{State}");
var lut = a.First();
lblS10Text = $"Update {lut.FileName}";
lblS10Text = $"Update {lut.FileCrc.ToString("0x8")}";
var _meterLutUpdate = new MeterLutUpdate(meter);
@@ -683,7 +729,7 @@ namespace CordonelAssemblyLine.Model
private void PickingLoop(CancellationToken token)
{
var converter = new System.Windows.Media.BrushConverter();
while (!token.IsCancellationRequested)
while (!token.IsCancellationRequested && !CloseTask)
{
switch (sm)
{
@@ -738,7 +784,11 @@ namespace CordonelAssemblyLine.Model
break;
case PickingStateMachine.WaitForScanning:
Scanner = $"Offen {ScannerPort}";
if (State != $"Warte auf Scannereingabe({ScannerPort})")
{
setState($"Warte auf Scannereingabe({ScannerPort})");
}
if (barScanner != null && !String.IsNullOrEmpty(barScanner.Input))
{
if (barScanner.Input == "%Cordonel_SAP_100%" || barScanner.Input == "%Cordonel_SAP_101%")
@@ -935,8 +985,6 @@ namespace CordonelAssemblyLine.Model
lblS09Text = $"{OrderOverview.KitronProductionDate}";
if (SkipProcessSteps == null || !SkipProcessSteps.SkipBatteyCheck)
{
if (OrderOverview.KitronProductionDate <= minDate)
{
setState($"Fehlgeschlagen Register ist zu alt! Bitte QS informieren. KitronProductionDate:{OrderOverview.KitronProductionDate }");
@@ -1080,6 +1128,7 @@ namespace CordonelAssemblyLine.Model
}
private void Log(string v)
{
//throw new NotImplementedException();
+7 -3
View File
@@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:CordonelAssemblyLine"
xmlns:ProductionControls="clr-namespace:Ui.ProductionControls;assembly=Ui.ProductionControls"
xmlns:ProductionControls1="clr-namespace:Ui.ProductionControls;assembly=ProductionControls" x:Class="CordonelAssemblyLine.Picking"
xmlns:ProductionControls1="clr-namespace:Ui.ProductionControls;assembly=ProductionControls" x:Class="CordonelAssemblyLine.Picking" Closing="Window_Closing"
mc:Ignorable="d"
Title="Kommissionierung" Height="600" Width="883.713" Background="Aquamarine" Loaded="Window_Loaded" FontSize="18" >
<Grid Background="{Binding ResultColor}" Margin="0,0,18,0">
@@ -41,10 +41,14 @@
<Label Background="{Binding ResultColor}" Content="Ergebnis:" HorizontalAlignment="Left" Margin="10,1,0,0" VerticalAlignment="Top" Grid.Row="3" Grid.Column="0" Height="36" Width="115" Grid.ColumnSpan="2" />
<Label Background="{Binding ResultColor}" Content="{Binding Result, UpdateSourceTrigger=PropertyChanged}" Margin="11,1,0,0" VerticalAlignment="Top" Grid.Row="3" Grid.Column="1" Height="36" HorizontalAlignment="Left" Width="527" />
<TextBlock Background="{Binding ResultColor}" Text="{Binding LogText, UpdateSourceTrigger=PropertyChanged}" FontSize="10" Grid.Column="1" Height="218" Margin="12,23,0,0" Grid.Row="6" TextWrapping="Wrap" VerticalAlignment="Top" HorizontalAlignment="Left" Width="526"/>
<ScrollViewer Grid.Column="1" Grid.Row="6" >
<TextBlock Background="{Binding ResultColor}" Text="{Binding LogText, UpdateSourceTrigger=PropertyChanged}" FontSize="10" Height="218" Margin="12,23,0,0" TextWrapping="Wrap" VerticalAlignment="Top" HorizontalAlignment="Left" Width="526"/>
</ScrollViewer>
<Label Background="{Binding ResultColor}" Content="Log:" HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Top" Grid.Row="6" Grid.Column="0" Height="36" Width="115" Grid.ColumnSpan="2" />
<Label Background="{Binding ResultColor}" Content="Historie:" HorizontalAlignment="Left" Margin="22,9,0,0" VerticalAlignment="Top" Grid.Column="3" Height="36" Width="288" Grid.RowSpan="2" />
<TextBlock Background="{Binding ResultColor}" Text="{Binding HistoryText, UpdateSourceTrigger=PropertyChanged}" FontSize="10" Grid.Column="2" HorizontalAlignment="Left" Margin="22,10,0,0" Grid.Row="1" TextWrapping="Wrap" Width="168" Grid.RowSpan="4" Height="140" VerticalAlignment="Top"/>
<ScrollViewer Grid.Column="2" Grid.Row="1" >
<TextBlock Background="{Binding ResultColor}" Text="{Binding HistoryText, UpdateSourceTrigger=PropertyChanged}" FontSize="10" HorizontalAlignment="Left" Margin="22,10,0,0" TextWrapping="Wrap" Width="168" Grid.RowSpan="4" Height="140" VerticalAlignment="Top"/>
</ScrollViewer>
<Label Background="{Binding ResultColor}" Content="Ep:" HorizontalAlignment="Left" Margin="11,0,0,0" VerticalAlignment="Top" Grid.Row="4" Height="36" Width="115" Grid.ColumnSpan="2" />
<Border Margin="10,10,10,0" Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="5" VerticalAlignment="Top" BorderBrush="Black" BorderThickness="2">
<Grid >
@@ -48,5 +48,11 @@ namespace CordonelAssemblyLine
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
Model.Dispose();
this.Title = "";
}
}
}
@@ -100,9 +100,8 @@
<PropertyGroup />
<PropertyGroup />
<PropertyGroup />
<PropertyGroup>
<NoWin32Manifest>true</NoWin32Manifest>
</PropertyGroup>
<PropertyGroup />
<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\net40\Newtonsoft.Json.dll</HintPath>
@@ -175,6 +175,10 @@ namespace CordonelPreadjustmentUi
var x2 = 0.000;
var y2 = 0.000;
decimal checkTempMeter;
try
{
if ((x <= points[0].Item1) && (x >= points.Last().Item1))
{
var i = 0;
@@ -200,6 +204,12 @@ namespace CordonelPreadjustmentUi
return checkTempMeter;
}
catch (Exception ex)
{
return 2;
}
}
public void setImage(Bitmap img)
{
@@ -548,7 +548,7 @@
// l_SettingsPreparationMetersize
//
this.l_SettingsPreparationMetersize.AutoSize = true;
this.l_SettingsPreparationMetersize.Location = new System.Drawing.Point(416, 64);
this.l_SettingsPreparationMetersize.Location = new System.Drawing.Point(416, 72);
this.l_SettingsPreparationMetersize.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.l_SettingsPreparationMetersize.Name = "l_SettingsPreparationMetersize";
this.l_SettingsPreparationMetersize.Size = new System.Drawing.Size(55, 13);
@@ -912,7 +912,7 @@ namespace CordonelPreadjustmentUi
if (culture.Name == "de-DE")
{
Message = "Warten bis Temperaturakquirierung beendet";
Message = "Warten bis Temperaturakquirierung beendet ist";
}
else
{
@@ -927,7 +927,7 @@ namespace CordonelPreadjustmentUi
if (culture.Name == "de-DE")
{
Message = "Warten bis Temperaturkalibrierung beendet";
Message = "Warten bis Temperaturkalibrierung beendet ist";
}
else
{
@@ -942,7 +942,7 @@ namespace CordonelPreadjustmentUi
if (culture.Name == "de-DE")
{
Message = "Warten bis Spühlvorgang beendet";
Message = "Warten bis Spülvorgang beendet ist";
}
else
{
@@ -15,5 +15,7 @@ namespace Logic.ProductionToProductMapper.Cordonel
NotPossibleDuePcblocked = 1 << 4,
PcbNotMatchingOrder = 1 << 5,
Error = 1 << 6,
NotPossibleDueNoPressureTestFound = 1 << 7,
NotPossibleDueNoHeTestFound = 1 << 8,
}
}
@@ -132,9 +132,9 @@ namespace Xylem.Common.Logic.ProductionOrderCore.OrderData
ret.PowerLevel = uint.Parse(a.First().IPowerLevelCalculated);
ret.PowerLevelOption = uint.Parse(a.First().IPowerLevelCalculated);
ret.ImpedanceCodeNew = (UInt32)new System.ComponentModel.UInt32Converter().ConvertFromString(a.First().IAntennaMatching);
ret.ImpedanceCodeNew = (UInt32)new System.ComponentModel.UInt32Converter().ConvertFromString(a.First()?.IAntennaMatching);
ret.ImpedanceCodeOption = (UInt32)new System.ComponentModel.UInt32Converter().ConvertFromString(a.First().IAntennaMatching);
ret.ImpedanceCodeOption = (UInt32)new System.ComponentModel.UInt32Converter().ConvertFromString(a.First()?.IAntennaMatching);
}
}
@@ -438,7 +438,7 @@ namespace ProductionUiCordonel
pc.Processes.Add(orderBarcode); //[x] [x] [x]
serialBarcode = new ProductionProcessCheckSerialNumber(SerialNumber);
serialBarcode = new ProductionProcessCheckSerialNumber(SerialNumber, RadioAdress.ToString());
pc.Processes.Add(serialBarcode); //[x] [x] [x]
//pc.Processes.Add(new ProductionProcessFullReadOut()); //[x] [x] [x]
@@ -449,12 +449,12 @@ namespace ProductionUiCordonel
//pc.Processes.Add(new ProductionProcessFinalParameterizationFix()); //[x] [x] []
pc.Processes.Add(new ProductionProcessFinalParameterizationVakoCsd(connectProcess)); //[x] [x] []
//var radioCheck = new ProductionProcessRadioCheck();
//orderBarcode.isDone += delegate (object sender, EventArgs e)
//{
// radioCheck.Ordernumber = ((ProductionProcessCheckOrderNumber)sender).Ordernumber;
//};
//pc.Processes.Add(radioCheck); //[] [] []
var radioCheck = new ProductionProcessRadioCheck();
orderBarcode.isDone += delegate (object sender, EventArgs e)
{
radioCheck.Ordernumber = ((ProductionProcessCheckOrderNumber)sender).Ordernumber;
};
pc.Processes.Add(radioCheck); //[] [] []
//pc.Processes.Add(new ProductionProcessSpecialConfig()); //[x] [x] []
@@ -720,7 +720,7 @@ namespace Service.MeterProcessState.Controllers
}
}
}
if (SkipRadioCheck)
{
@@ -741,7 +741,7 @@ namespace Service.MeterProcessState.Controllers
// return Request.CreateResponse(HttpStatusCode.ExpectationFailed, await Task.Run(() => { return "No radio parameter found!"; }));
}
}
//return new RadioConfigurationParams();//
}
@@ -264,6 +264,174 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
[Route("GetPreMarriageStateMSG"), HttpGet]
public async Task<HttpResponseMessage> GetPreMarriageState(string PcbId)
{
try
{
return await Task.Run(() =>
{
try
{
var retSerial = "";
var retOrder = "";
var retFreeSrn = "";
var internalSerialNr = -1;
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var sb = new StringBuilder();
sb = new StringBuilder();
sb.AppendLine($" Declare @SerialNumber int ");
sb.AppendLine($" Declare @PcbId Nvarchar(50) ");
sb.AppendLine($" Declare @PcbIsPartOfOrder int ");
sb.AppendLine($" Declare @LastHeTest int ");
sb.AppendLine($" Declare @LastPressureTest int ");
sb.AppendLine($" set @SerialNumber = {internalSerialNr} ");
sb.AppendLine($" set @PcbId = '{PcbId}' ");
sb.AppendLine($" select @PcbIsPartOfOrder = picking.CordonelAssignedPicking_FertigungsAuftragsNr, @SerialNumber = srn.SerienNr from ");
sb.AppendLine($" Cordonel_AssignedPicking picking ");
sb.AppendLine($" inner join AuftragPosition_gesamt apos on apos.FertigungsauftragNr=picking.CordonelAssignedPicking_FertigungsAuftragsNr ");
sb.AppendLine($" inner join AuftragPositionSerienNr srn on apos.AuftragNr=srn.AuftragNr and apos.PositionNr=srn.PositionNr ");
sb.AppendLine($" where picking.CordonelAssignedPicking_IsDeleted=0 and picking.CordonelAssignedPicking_PcbId=@PcbId ");
sb.AppendLine($" select top 1 @LastHeTest = CordonelPressureTest_Id from Cordonel_PressureTest ");
sb.AppendLine($" where CordonelPressureTest_PcbId = @PcbId and CordonelPressureTest_FertigungsAuftragsNr = @PcbIsPartOfOrder ");
sb.AppendLine($" and CordonelPressureTest_Valid = 1 and CordonelPressureTest_IsDeleted = 0 ");
sb.AppendLine($" ");
sb.AppendLine($" select top 1 @LastPressureTest = [Pruefgang] from [Druckpruefung] ");
sb.AppendLine($" where [FabNr] = @PcbId and [FertigungsauftragNr] = @PcbIsPartOfOrder ");
sb.AppendLine($" and [Dicht] = 1 ");
sb.AppendLine($" order by [Pruefgang] desc ");
sb.AppendLine($" DECLARE @FreeSrnList varchar(max) ");
sb.AppendLine($" SELECT @FreeSrnList = COALESCE(@FreeSrnList + ', ', '') + ");
sb.AppendLine($" CAST(FreeSrn AS varchar(10)) ");
sb.AppendLine($" FROM(select distinct SerienNr as FreeSrn from ");
sb.AppendLine($" AuftragPosition_gesamt apos ");
sb.AppendLine($" inner join AuftragPositionSerienNr srn on apos.AuftragNr = srn.AuftragNr and apos.PositionNr = srn.PositionNr ");
sb.AppendLine($" left outer join MapPcbIdToSerialNumber map on map.MapPcbIdToSerialNumber_SerialNumber = SerienNr and map.MapPcbIdToSerialNumber_Deleted = 0 ");
sb.AppendLine($" where apos.FertigungsauftragNr = @PcbIsPartOfOrder ");
sb.AppendLine($" and map.MapPcbIdToSerialNumber_SerialNumber is null) ");
sb.AppendLine($" as Free ");
sb.AppendLine($" select @PcbId as PcbId, @SerialNumber as SerialNumber,0 as AlreadyMarried ,0 as SerialNumberBlocked ,0 as PcbBlocked ,@PcbIsPartOfOrder as PcbIsPartOfOrder, @LastHeTest as LastHeTest, @LastPressureTest as LastPressureTest, @FreeSrnList as FreeSrn ");
sb.AppendLine($" union ");
sb.AppendLine($" SELECT distinct ");
sb.AppendLine($" [MapPcbIdToSerialNumber_PcbId] as PcbId ");
sb.AppendLine($" ,[MapPcbIdToSerialNumber_SerialNumber] as SerialNumber ");
sb.AppendLine($" ,CASE WHEN [MapPcbIdToSerialNumber_PcbId] = @PcbId and [MapPcbIdToSerialNumber_SerialNumber] = @SerialNumber ");
sb.AppendLine($" THEN 1 else 0 END as AlreadyMarried ");
sb.AppendLine($" ,CASE WHEN [MapPcbIdToSerialNumber_PcbId] <> @PcbId and [MapPcbIdToSerialNumber_SerialNumber] = @SerialNumber ");
sb.AppendLine($" THEN 1 else 0 END as SerialNumberBlocked ");
sb.AppendLine($" ,CASE WHEN [MapPcbIdToSerialNumber_PcbId] = @PcbId and [MapPcbIdToSerialNumber_SerialNumber] <> @SerialNumber ");
sb.AppendLine($" THEN 1 else 0 END as PcbBlocked , ");
sb.AppendLine($" @PcbIsPartOfOrder as PcbIsPartOfOrder , ");
sb.AppendLine($" @LastHeTest as LastHeTest , ");
sb.AppendLine($" @LastPressureTest as LastPressureTest, null as FreeSrn ");
sb.AppendLine($" FROM [Auftrag].[dbo].[MapPcbIdToSerialNumber] ");
sb.AppendLine($" where MapPcbIdToSerialNumber_Deleted = 0 ");
sb.AppendLine($" and ([MapPcbIdToSerialNumber_PcbId] = @PcbId or [MapPcbIdToSerialNumber_SerialNumber] = @SerialNumber) ");
var dtRet = dataacces.ExecuteQuery(sb.ToString());
var ret = MarriagePossibleEnum.None;
if (dtRet.Rows.Count == 0)
{
ret = ret | MarriagePossibleEnum.Error;
}
foreach (var item in dtRet.Rows)
{
if (item is DataRow dr)
{
if (!string.IsNullOrEmpty(dr["SerialNumber"].ToString()) && dr["SerialNumber"].ToString() != "-1")
{
retSerial = retSerial + dr["SerialNumber"].ToString() + ";";
}
if (string.IsNullOrEmpty(dr["PcbIsPartOfOrder"].ToString()))
{
ret = ret | MarriagePossibleEnum.PcbNotMatchingOrder;
}
else
{
retOrder = retOrder + dr["PcbIsPartOfOrder"].ToString() + ";";
}
if (!string.IsNullOrEmpty(dr["FreeSrn"].ToString()))
{
retFreeSrn = retFreeSrn + dr["FreeSrn"].ToString() + ";";
}
if (dr["AlreadyMarried"].ToString() == "1")
{
ret = ret | MarriagePossibleEnum.NotPossibleDueAlredayMatch;
}
if (dr["SerialNumberBlocked"].ToString() == "1")
{
ret = ret | MarriagePossibleEnum.NotPossibleDueSerialNumberBlocked;
}
if (dr["PcbBlocked"].ToString() == "1")
{
ret = ret | MarriagePossibleEnum.NotPossibleDuePcblocked;
}
if (dr["PcbBlocked"].ToString() == "1")
{
ret = ret | MarriagePossibleEnum.NotPossibleDuePcblocked;
}
if (dr["LastHeTest"] == DBNull.Value)
{
ret = ret | MarriagePossibleEnum.NotPossibleDueNoHeTestFound;
}
if (dr["LastPressureTest"] == DBNull.Value)
{
ret = ret | MarriagePossibleEnum.NotPossibleDueNoPressureTestFound;
}
}
}
if (ret == MarriagePossibleEnum.None)
{
ret = MarriagePossibleEnum.Possible;
}
return Request.CreateResponse(HttpStatusCode.OK, new object[] { ret , retOrder, retSerial, retFreeSrn });
}
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.OK, new object[] { MarriagePossibleEnum.Error, null, null, null } );
}
});
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.InternalServerError, ex);
}
}
[Route("GetPreMarriageState"), HttpGet]
public async Task<HttpResponseMessage> GetPreMarriageState(string PcbId, string SerialNumber)
{
@@ -290,12 +458,15 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
sb.AppendLine($" Declare @SerialNumber int ");
sb.AppendLine($" Declare @PcbId Nvarchar(50) ");
sb.AppendLine($" Declare @PcbIsPartOfOrder int ");
sb.AppendLine($" Declare @LastHeTest int ");
sb.AppendLine($" Declare @LastPressureTest int ");
sb.AppendLine($" set @SerialNumber = {internalSerialNr} ");
sb.AppendLine($" set @PcbId = '{PcbId}' ");
sb.AppendLine($" select @PcbIsPartOfOrder = picking.CordonelAssignedPicking_FertigungsAuftragsNr, @SerialNumber = srn.SerienNr from ");
sb.AppendLine($" Cordonel_AssignedPicking picking ");
sb.AppendLine($" inner join AuftragPosition_gesamt apos on apos.FertigungsauftragNr=picking.CordonelAssignedPicking_FertigungsAuftragsNr ");
sb.AppendLine($" inner join AuftragPositionSerienNr srn on apos.AuftragNr=srn.AuftragNr and apos.PositionNr=srn.PositionNr and ");
@@ -308,10 +479,21 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
sb.AppendLine($" REPLACE(srn.KundeneigeneSerienNr, ' ', '') like '%{cust}%' ");
}
sb.AppendLine($" where picking.CordonelAssignedPicking_IsDeleted=0 and picking.CordonelAssignedPicking_PcbId=@PcbId ");
sb.AppendLine($" select @PcbId as PcbId, @SerialNumber as SerialNumber,0 as AlreadyMarried ,0 as SerialNumberBlocked ,0 as PcbBlocked ,@PcbIsPartOfOrder as PcbIsPartOfOrder ");
sb.AppendLine($" select top 1 @LastHeTest = CordonelPressureTest_Id from Cordonel_PressureTest ");
sb.AppendLine($" where CordonelPressureTest_PcbId = @PcbId and CordonelPressureTest_FertigungsAuftragsNr = @PcbIsPartOfOrder ");
sb.AppendLine($" and CordonelPressureTest_Valid = 1 and CordonelPressureTest_IsDeleted = 0 ");
sb.AppendLine($" ");
sb.AppendLine($" select top 1 @LastPressureTest = [Pruefgang] from [Druckpruefung] ");
sb.AppendLine($" where [FabNr] = @PcbId and [FertigungsauftragNr] = @PcbIsPartOfOrder ");
sb.AppendLine($" and [Dicht] = 1 ");
sb.AppendLine($" order by [Pruefgang] desc ");
sb.AppendLine($" select @PcbId as PcbId, @SerialNumber as SerialNumber,0 as AlreadyMarried ,0 as SerialNumberBlocked ,0 as PcbBlocked ,@PcbIsPartOfOrder as PcbIsPartOfOrder, @LastHeTest as LastHeTest, @LastPressureTest as LastPressureTest ");
sb.AppendLine($" union ");
sb.AppendLine($" SELECT distinct ");
sb.AppendLine($" [MapPcbIdToSerialNumber_PcbId] as PcbId ");
@@ -322,7 +504,9 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
sb.AppendLine($" THEN 1 else 0 END as SerialNumberBlocked ");
sb.AppendLine($" ,CASE WHEN [MapPcbIdToSerialNumber_PcbId] = @PcbId and [MapPcbIdToSerialNumber_SerialNumber] <> @SerialNumber ");
sb.AppendLine($" THEN 1 else 0 END as PcbBlocked , ");
sb.AppendLine($" @PcbIsPartOfOrder as PcbIsPartOfOrder ");
sb.AppendLine($" @PcbIsPartOfOrder as PcbIsPartOfOrder , ");
sb.AppendLine($" @LastHeTest as LastHeTest , ");
sb.AppendLine($" @LastPressureTest as LastPressureTest ");
sb.AppendLine($" FROM [Auftrag].[dbo].[MapPcbIdToSerialNumber] ");
sb.AppendLine($" where MapPcbIdToSerialNumber_Deleted = 0 ");
sb.AppendLine($" and ([MapPcbIdToSerialNumber_PcbId] = @PcbId or [MapPcbIdToSerialNumber_SerialNumber] = @SerialNumber) ");
@@ -359,6 +543,20 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
ret = ret | MarriagePossibleEnum.NotPossibleDuePcblocked;
}
if (dr["PcbBlocked"].ToString() == "1")
{
ret = ret | MarriagePossibleEnum.NotPossibleDuePcblocked;
}
if (dr["LastHeTest"] == DBNull.Value)
{
ret = ret | MarriagePossibleEnum.NotPossibleDueNoHeTestFound;
}
if (dr["LastPressureTest"] == DBNull.Value)
{
ret = ret | MarriagePossibleEnum.NotPossibleDueNoPressureTestFound;
}
}
}
+16 -3
View File
@@ -33,6 +33,7 @@
this.panel1 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.textBox2 = new System.Windows.Forms.TextBox();
this.button2 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// textBox1
@@ -54,16 +55,16 @@
//
// panel1
//
this.panel1.Location = new System.Drawing.Point(554, 112);
this.panel1.Location = new System.Drawing.Point(554, 12);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(450, 30);
this.panel1.Size = new System.Drawing.Size(491, 138);
this.panel1.TabIndex = 2;
//
// panel2
//
this.panel2.Location = new System.Drawing.Point(554, 156);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(450, 30);
this.panel2.Size = new System.Drawing.Size(503, 215);
this.panel2.TabIndex = 4;
//
// textBox2
@@ -73,11 +74,22 @@
this.textBox2.Size = new System.Drawing.Size(367, 20);
this.textBox2.TabIndex = 3;
//
// button2
//
this.button2.Location = new System.Drawing.Point(319, 257);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(109, 62);
this.button2.TabIndex = 5;
this.button2.Text = "button2";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// FrmLegacyTestAppStart
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1378, 871);
this.Controls.Add(this.button2);
this.Controls.Add(this.panel2);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.panel1);
@@ -98,5 +110,6 @@
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Button button2;
}
}
@@ -10,24 +10,21 @@ namespace GenesisToolBox
{
InitializeComponent();
}
private ctlEasyMeterRdy ctlEasyMeterRdy1;
private ctlEasyMeterRdy ctlEasyMeterRdy2;
private ctlCRdy ctlEasyMeterRdy1;
private ctlCRdy ctlEasyMeterRdy2;
private void FrmLegacyTestAppStart_Load(object sender, EventArgs e)
{
ctlEasyMeterRdy1 = new ctlEasyMeterRdy(1);
ctlEasyMeterRdy2 = new ctlEasyMeterRdy(2);
ctlEasyMeterRdy1 = new ctlCRdy();
ctlEasyMeterRdy2 = new ctlCRdy();
panel1.Controls.Add(ctlEasyMeterRdy1);
panel2.Controls.Add(ctlEasyMeterRdy2);
ctlEasyMeterRdy1.Expand += CtlEasyMeterRdy1_Expand;
ctlEasyMeterRdy2.Expand += CtlEasyMeterRdy2_Expand;
ctlEasyMeterRdy1.Init(1);
ctlEasyMeterRdy2.Init(2);
CtlEasyMeterRdy1_Expand(null, new PopEventArgs() { Show = false });
CtlEasyMeterRdy2_Expand(null, new PopEventArgs() { Show = false });
}
private void CtlEasyMeterRdy1_Expand(object sender, PopEventArgs e)
@@ -45,5 +42,18 @@ namespace GenesisToolBox
{
ctlEasyMeterRdy1.Start(false);
}
private void button2_Click(object sender, EventArgs e)
{
string pcb;
string sr;
bool pre;
bool waring;
string lut;
var ret = ctlEasyMeterRdy1.GetAllInfos(out pcb, out sr, out pre, out waring, out lut);
}
}
}
+23 -22
View File
@@ -29,6 +29,7 @@
private void InitializeComponent()
{
this.gpGerneral = new System.Windows.Forms.GroupBox();
this.button1 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.btnLutUpdate = new System.Windows.Forms.Button();
this.btnPressure = new System.Windows.Forms.Button();
@@ -43,14 +44,13 @@
this.button2 = new System.Windows.Forms.Button();
this.btnPara = new System.Windows.Forms.Button();
this.btnRegHistory = new System.Windows.Forms.Button();
this.btnRelatePCbID = new System.Windows.Forms.Button();
this.btnPassword = new System.Windows.Forms.Button();
this.gbDeveloper = new System.Windows.Forms.GroupBox();
this.BtnFileSplit = new System.Windows.Forms.Button();
this.btnFiles = new System.Windows.Forms.Button();
this.btnLegacyTestApp = new System.Windows.Forms.Button();
this.lblVersionNumber = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.btnLog = new System.Windows.Forms.Button();
this.gpGerneral.SuspendLayout();
this.gpLAA.SuspendLayout();
this.gbDeveloper.SuspendLayout();
@@ -76,6 +76,16 @@
this.gpGerneral.TabStop = false;
this.gpGerneral.Text = "General";
//
// button1
//
this.button1.Location = new System.Drawing.Point(6, 413);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(152, 40);
this.button1.TabIndex = 19;
this.button1.Text = "Pulse Config";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click_1);
//
// button4
//
this.button4.Location = new System.Drawing.Point(7, 321);
@@ -168,11 +178,11 @@
//
// gpLAA
//
this.gpLAA.Controls.Add(this.btnLog);
this.gpLAA.Controls.Add(this.button5);
this.gpLAA.Controls.Add(this.button2);
this.gpLAA.Controls.Add(this.btnPara);
this.gpLAA.Controls.Add(this.btnRegHistory);
this.gpLAA.Controls.Add(this.btnRelatePCbID);
this.gpLAA.Controls.Add(this.btnPassword);
this.gpLAA.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.gpLAA.Location = new System.Drawing.Point(201, 37);
@@ -225,16 +235,6 @@
this.btnRegHistory.UseVisualStyleBackColor = true;
this.btnRegHistory.Click += new System.EventHandler(this.btnRegHistory_Click);
//
// btnRelatePCbID
//
this.btnRelatePCbID.Location = new System.Drawing.Point(5, 61);
this.btnRelatePCbID.Name = "btnRelatePCbID";
this.btnRelatePCbID.Size = new System.Drawing.Size(152, 40);
this.btnRelatePCbID.TabIndex = 10;
this.btnRelatePCbID.Text = "PcbID -> SerialNumber";
this.btnRelatePCbID.UseVisualStyleBackColor = true;
this.btnRelatePCbID.Click += new System.EventHandler(this.btnRelatePCbID_Click);
//
// btnPassword
//
this.btnPassword.Enabled = false;
@@ -300,15 +300,16 @@
this.lblVersionNumber.TabIndex = 23;
this.lblVersionNumber.Text = "----------";
//
// button1
// btnLog
//
this.button1.Location = new System.Drawing.Point(6, 413);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(152, 40);
this.button1.TabIndex = 19;
this.button1.Text = "Pulse Config";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click_1);
this.btnLog.Location = new System.Drawing.Point(5, 61);
this.btnLog.Name = "btnLog";
this.btnLog.Size = new System.Drawing.Size(152, 40);
this.btnLog.TabIndex = 22;
this.btnLog.Text = "Log";
this.btnLog.UseMnemonic = false;
this.btnLog.UseVisualStyleBackColor = true;
this.btnLog.Click += new System.EventHandler(this.btnLog_Click);
//
// FrmMainForm
//
@@ -347,7 +348,6 @@
private System.Windows.Forms.GroupBox gpLAA;
private System.Windows.Forms.Button btnPara;
private System.Windows.Forms.Button btnRegHistory;
private System.Windows.Forms.Button btnRelatePCbID;
private System.Windows.Forms.Button btnPassword;
private System.Windows.Forms.GroupBox gbDeveloper;
private System.Windows.Forms.Button BtnFileSplit;
@@ -360,6 +360,7 @@
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Label lblVersionNumber;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button btnLog;
}
}
+8
View File
@@ -394,5 +394,13 @@ namespace Xylem.Common.Ui.GenesisToolBox
form.Closed += Form_Closed;
Hide();
}
private void btnLog_Click(object sender, EventArgs e)
{
var form = new FrmLog();
form.Show();
form.Closed += Form_Closed;
Hide();
}
}
}
+1 -1
View File
@@ -671,7 +671,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
if (regDef.DataType == typeof(String) || regDef.DataType == typeof(Int64) ||
regDef.DataType == typeof(UInt64))
{
rawRegister = _currentGenesis.ReadRegister(reg, 12);
rawRegister = _currentGenesis.ReadRegister(reg, 8);
}
else
{
@@ -11,7 +11,6 @@ namespace XylemCommonUiLegacyGenCtl.DataPackage
{
public bool WatingForDecision { get; set; } = true;
public bool DirectStart { get; set; } = false;
public TempSouceType TempSouce { get; set; }
public MeterSize MeterSize { get; set; }
@@ -9,7 +9,7 @@ namespace XylemCommonUiLegacyGenCtl
[ClassInterface(ClassInterfaceType.AutoDual)]
[Guid("FDD23F12-5AE6-4D23-BF34-9C46EA61F02E")]
[Guid("FDD23F12-5AE6-4D23-BF34-9C46EA72F02E")]
[ComVisible(true)]
public class PopEventArgs : EventArgs
{
@@ -18,7 +18,7 @@ namespace XylemCommonUiLegacyGenCtl
[ClassInterface(ClassInterfaceType.AutoDual)]
[Guid("AE0875F7-D30D-4113-AE28-E0CBD0372544")]
[Guid("AE0875F7-D30D-4113-AE28-E0CBD0373544")]
[ComVisible(true)]
public class StateChangeEventArgs : EventArgs
{
@@ -33,14 +33,20 @@ namespace XylemCommonUiLegacyGenCtl
public delegate void OnPop(Object sender, PopEventArgs e);
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
[Guid("A1095409-2795-42C7-B6B6-800B4F76CA60")]
public interface IEasyMeterRdy
[Guid("A1095409-2795-45C7-B6B6-800B4F76CA60")]
public interface ICRdy
{
[DispId(1)]
void OneStateChange();
[DispId(2)]
void OnPop(Object sender, PopEventArgs e);
void Init(int v);
void Start();
bool GetAllInfos(out string oPcbId, out string oSerialNumber, out bool oHasPreajustment, out bool oHasWarnings, out string oLUT);
}
}
@@ -0,0 +1,58 @@
using System;
using System.Runtime.InteropServices;
namespace XylemCommonUiLegacyGenCtl
{
[Guid("905FD089-A09F-48CB-9EAF-E8F0328655A1")
, ComVisible(true)
, InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface ITstCont
{
void Init();
dynamic GetContainer();
void SetWatingForDecision(bool v);
bool GetWatingForDecision();
void SetTempSouceFlansch();
bool GetTempSouceFlansch();
void SetTempSouceSPS();
bool GetTempSouceSPS();
void SetTempSouceManually();
bool GetTempSouceManually();
void SetMetersize(int v);
int GetMetersize();
void SetDelayInSBeforStart(int v);
int GetDelayInSBeforStart();
void SetAllChanelsRequired(bool v);
bool GetAllChanelsRequired();
void SetProductionMode(bool v);
bool GetProductionMode();
void SetMeterTestSettings(int Slot, string SerialNr, bool FlowAdjustment, double FlowAdjustmentTarget, bool PreAdjustment, bool FlowTesting);
string GetMeterSerialNr(int Slot);
bool GetFlowAdjustment(int Slot);
bool GetPreAdjustment(int Slot);
double GetFlowAdjustmentTarget(int Slot);
bool GetFlowTesting(int Slot);
bool GetAnyMeterFlowAdjustment();
bool GetAnyMeterPreAdjustment();
bool GetAnyMeterFlowTesting();
}
}
@@ -103,11 +103,11 @@
<Compile Include="ctlBenchRdy.Designer.cs">
<DependentUpon>ctlBenchRdy.cs</DependentUpon>
</Compile>
<Compile Include="ctlEasyMeterRdy.cs">
<Compile Include="ctlCRdy.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="ctlEasyMeterRdy.Designer.cs">
<DependentUpon>ctlEasyMeterRdy.cs</DependentUpon>
<Compile Include="ctlCRdy.Designer.cs">
<DependentUpon>ctlCRdy.cs</DependentUpon>
</Compile>
<Compile Include="ctlMeterReady.cs">
<SubType>UserControl</SubType>
@@ -122,7 +122,8 @@
<Compile Include="Enums\MeterReadyResults.cs" />
<Compile Include="Enums\TempSouceType.cs" />
<Compile Include="ICtlTestBench.cs" />
<Compile Include="IEasyMeterRdy.cs" />
<Compile Include="ICRdy.cs" />
<Compile Include="ITstCont.cs" />
<Compile Include="PreAdjWr.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -149,14 +150,15 @@
<Compile Include="ICtlBatch.cs" />
<Compile Include="ICtlPreadjustment.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TstContHlp.cs" />
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="ctlBenchRdy.resx">
<DependentUpon>ctlBenchRdy.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="ctlEasyMeterRdy.resx">
<DependentUpon>ctlEasyMeterRdy.cs</DependentUpon>
<EmbeddedResource Include="ctlCRdy.resx">
<DependentUpon>ctlCRdy.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="ctlMeterReady.resx">
<DependentUpon>ctlMeterReady.cs</DependentUpon>
@@ -309,7 +309,6 @@ namespace XylemCommonUiLegacyGenCtl
StringBuilder sb = new StringBuilder();
sb.AppendLine($"WatingForDecision={container.WatingForDecision}");
sb.AppendLine($"DirectStart={container.DirectStart}");
sb.AppendLine($"TempSouce={container.TempSouce}");
sb.AppendLine($"MeterSize={container.MeterSize}");
sb.AppendLine($"DelayInSBeforStart={container.DelayInSBeforStart}");
@@ -0,0 +1,317 @@
using Logic.ProductionToProductMapper.Cordonel;
using System;
using System.Linq;
using System.Runtime.InteropServices;
using XylemCommonUiLegacyGenCtl.DataPackage;
namespace XylemCommonUiLegacyGenCtl
{
[Guid("870BA78D-F176-4125-9125-F3FD3A496423"),
ComVisible(true),
ClassInterface(ClassInterfaceType.None),
ComSourceInterfaces(typeof(ITstCont))]
public class TstContHlp : ITstCont
{
private TestSetupContainer testSetup;
public TstContHlp()
{
Init();
}
public void Init()
{
testSetup = new TestSetupContainer();
}
public dynamic GetContainer()
{
return testSetup;
}
public bool GetAllChanelsRequired()
{
if (testSetup == null)
{
return false;
}
return testSetup.AllChanelsRequired;
}
public int GetDelayInSBeforStart()
{
if (testSetup == null)
{
return 0;
}
return testSetup.DelayInSBeforStart;
}
public int GetMetersize()
{
if (testSetup == null)
{
return 0;
}
return MeterSizeConverter.ConvertToOrder(testSetup.MeterSize);
}
public bool GetProductionMode()
{
if (testSetup == null)
{
return true;
}
return testSetup.ProductionMode;
}
public bool GetWatingForDecision()
{
if (testSetup == null)
{
return false;
}
return testSetup.WatingForDecision;
}
public bool GetTempSouceFlansch()
{
if (testSetup == null)
{
return false;
}
return testSetup.TempSouce == Enums.TempSouceType.TempFlansh;
}
public bool GetTempSouceSPS()
{
if (testSetup == null)
{
return false;
}
return testSetup.TempSouce == Enums.TempSouceType.PtOverSps;
}
public bool GetTempSouceManually()
{
if (testSetup == null)
{
return false;
}
return testSetup.TempSouce == Enums.TempSouceType.ManualInput;
}
public void SetAllChanelsRequired(bool v)
{
HanldWrongInput();
testSetup.AllChanelsRequired = v;
}
public void SetDelayInSBeforStart(int v)
{
HanldWrongInput();
testSetup.DelayInSBeforStart = v;
}
public void SetMetersize(int v)
{
HanldWrongInput();
testSetup.MeterSize = MeterSizeConverter.ConvertToMeter(v);
}
public void SetProductionMode(bool v)
{
HanldWrongInput();
testSetup.ProductionMode = v;
}
public void SetWatingForDecision(bool v)
{
HanldWrongInput();
testSetup.WatingForDecision = v;
}
public void SetTempSouceFlansch()
{
HanldWrongInput();
testSetup.TempSouce = Enums.TempSouceType.TempFlansh;
}
public void SetTempSouceManually()
{
HanldWrongInput();
testSetup.TempSouce = Enums.TempSouceType.ManualInput;
}
public void SetTempSouceSPS()
{
HanldWrongInput();
testSetup.TempSouce = Enums.TempSouceType.PtOverSps;
}
#region MeterStuff
public void SetMeterTestSettings(int Slot, string SerialNr, bool FlowAdjustment, double FlowAdjustmentTarget, bool PreAdjustment, bool FlowTesting)
{
HanldWrongInputMeters(Slot);
if (testSetup.meterTestSettings[Slot - 1] == null)
{
testSetup.meterTestSettings[Slot - 1] = new MeterTestSettings();
}
testSetup.meterTestSettings[Slot - 1].Slot = Slot;
testSetup.meterTestSettings[Slot - 1].SerialNr = SerialNr;
testSetup.meterTestSettings[Slot - 1].FlowAdjustment = FlowAdjustment;
testSetup.meterTestSettings[Slot - 1].FlowAdjustmentTarget = Convert.ToDecimal(FlowAdjustmentTarget);
testSetup.meterTestSettings[Slot - 1].PreAdjustment = PreAdjustment;
testSetup.meterTestSettings[Slot - 1].FlowTesting = FlowTesting;
}
public bool GetPreAdjustment(int Slot)
{
if (testSetup.meterTestSettings[Slot - 1] == null)
{
return false;
}
return testSetup.meterTestSettings[Slot - 1].PreAdjustment;
}
public bool GetFlowAdjustment(int Slot)
{
if (testSetup.meterTestSettings[Slot - 1] == null)
{
return false;
}
return testSetup.meterTestSettings[Slot - 1].FlowAdjustment;
}
public double GetFlowAdjustmentTarget(int Slot)
{
if (testSetup.meterTestSettings[Slot - 1] == null)
{
return 0;
}
return Convert.ToDouble(testSetup.meterTestSettings[Slot - 1].FlowAdjustmentTarget);
}
public bool GetFlowTesting(int Slot)
{
if (testSetup.meterTestSettings[Slot - 1] == null)
{
return true;
}
return testSetup.meterTestSettings[Slot - 1].FlowTesting;
}
public string GetMeterSerialNr(int Slot)
{
if (testSetup.meterTestSettings[Slot - 1] == null)
{
return "";
}
return testSetup.meterTestSettings[Slot - 1].SerialNr;
}
public bool GetAnyMeterFlowAdjustment()
{
if (testSetup == null)
{
return false;
}
if (testSetup.meterTestSettings == null)
{
return false;
}
return testSetup.meterTestSettings.Any(x => x.FlowAdjustment);
}
public bool GetAnyMeterFlowTesting()
{
if (testSetup == null)
{
return false;
}
if (testSetup.meterTestSettings == null)
{
return false;
}
return testSetup.meterTestSettings.Any(x => x.FlowTesting);
}
public bool GetAnyMeterPreAdjustment()
{
if (testSetup == null)
{
return false;
}
if (testSetup.meterTestSettings == null)
{
return false;
}
return testSetup.meterTestSettings.Any(x => x.PreAdjustment);
}
#endregion
#region internalStuff
private void HanldWrongInput()
{
if (testSetup == null)
{
testSetup = new TestSetupContainer();
}
}
private void HanldWrongInputMeters(int Slot)
{
HanldWrongInput();
if (testSetup.meterTestSettings == null)
{
testSetup.meterTestSettings = new MeterTestSettings[12];
}
if (Slot < 0 || Slot > 13)
{
throw new Exception("Ungültiger Einbauplatz");
}
}
#endregion
}
}
+1 -15
View File
@@ -945,24 +945,11 @@ namespace XylemCommonUiLegacyGenCtl
{
CalibrationIsDone.Add(meter.Slot, LegacyCalibrationResult.Pending);
}
if (!((GenesisMeter)meter).IsLoggedOn)
{
listOfTasks.Add(new Task(() =>
{
var r = ((GenesisMeter)meter).Login();
//if (r)
//{
// var alarms = ((GenesisMeter)meter).GetAlarms();
// WarningMetersAlarms.AddOrUpdate(meter.Slot, alarms, (key, oldValue) => alarms);
// ((GenesisMeter)meter).ResetAlarm(TestBenchReleAlarms);
//}
}));
}
listOfTasksInit.Add(new Task(() =>
{
var r = ((GenesisMeter)meter).Login();
var r = ((GenesisMeter)meter).ReLogin();
if (_useRequest)
{
_logger.Debug($"Prepare Meters for Measurement/Adjustment");
@@ -2108,7 +2095,6 @@ namespace XylemCommonUiLegacyGenCtl
StringBuilder sb = new StringBuilder();
sb.AppendLine($"WatingForDecision={container.WatingForDecision}");
sb.AppendLine($"DirectStart={container.DirectStart}");
sb.AppendLine($"TempSouce={container.TempSouce}");
sb.AppendLine($"MeterSize={container.MeterSize}");
sb.AppendLine($"DelayInSBeforStart={container.DelayInSBeforStart}");
@@ -415,7 +415,6 @@ namespace XylemCommonUiLegacyGenCtl
{
OverallCancellationTokenSource.Cancel();
testControler = new TestSetupContainer();
testControler.DirectStart = start;
if (rbtTempManualInput.Checked)
{
testControler.TempSouce = Enums.TempSouceType.ManualInput;
@@ -1,6 +1,6 @@
namespace XylemCommonUiLegacyGenCtl
{
partial class ctlEasyMeterRdy
partial class ctlCRdy
{
/// <summary>
/// Required designer variable.
@@ -37,11 +37,11 @@
this.lblDataP2 = new System.Windows.Forms.Label();
this.lblDataP3 = new System.Windows.Forms.Label();
this.tmrBusy = new System.Windows.Forms.Timer(this.components);
this.lblFlowTest = new System.Windows.Forms.Label();
this.lblPreadjustment = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.lblPcbId = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.lblPreadjustment = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.lblLut = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// lblLogin
@@ -50,7 +50,7 @@
this.lblLogin.BackColor = System.Drawing.Color.LightGray;
this.lblLogin.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.lblLogin.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblLogin.Location = new System.Drawing.Point(165, 1);
this.lblLogin.Location = new System.Drawing.Point(98, 1);
this.lblLogin.Name = "lblLogin";
this.lblLogin.Size = new System.Drawing.Size(55, 22);
this.lblLogin.TabIndex = 6;
@@ -62,7 +62,7 @@
this.lblLed.BackColor = System.Drawing.Color.LightGray;
this.lblLed.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.lblLed.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblLed.Location = new System.Drawing.Point(219, 1);
this.lblLed.Location = new System.Drawing.Point(152, 1);
this.lblLed.Name = "lblLed";
this.lblLed.Size = new System.Drawing.Size(46, 22);
this.lblLed.TabIndex = 7;
@@ -74,7 +74,7 @@
this.lblDataOverall.BackColor = System.Drawing.Color.LightGray;
this.lblDataOverall.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.lblDataOverall.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblDataOverall.Location = new System.Drawing.Point(264, 1);
this.lblDataOverall.Location = new System.Drawing.Point(197, 1);
this.lblDataOverall.Name = "lblDataOverall";
this.lblDataOverall.Size = new System.Drawing.Size(87, 22);
this.lblDataOverall.TabIndex = 8;
@@ -86,7 +86,7 @@
this.lblDataDisplay.BackColor = System.Drawing.Color.LightGray;
this.lblDataDisplay.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.lblDataDisplay.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Bold);
this.lblDataDisplay.Location = new System.Drawing.Point(350, 1);
this.lblDataDisplay.Location = new System.Drawing.Point(283, 1);
this.lblDataDisplay.Name = "lblDataDisplay";
this.lblDataDisplay.Size = new System.Drawing.Size(66, 15);
this.lblDataDisplay.TabIndex = 9;
@@ -99,7 +99,7 @@
this.lblDataP1.BackColor = System.Drawing.Color.LightGray;
this.lblDataP1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.lblDataP1.Font = new System.Drawing.Font("Microsoft Sans Serif", 6F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblDataP1.Location = new System.Drawing.Point(350, 15);
this.lblDataP1.Location = new System.Drawing.Point(283, 15);
this.lblDataP1.Name = "lblDataP1";
this.lblDataP1.Size = new System.Drawing.Size(21, 11);
this.lblDataP1.TabIndex = 10;
@@ -111,7 +111,7 @@
this.lblDataP2.BackColor = System.Drawing.Color.LightGray;
this.lblDataP2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.lblDataP2.Font = new System.Drawing.Font("Microsoft Sans Serif", 6F, System.Drawing.FontStyle.Bold);
this.lblDataP2.Location = new System.Drawing.Point(371, 15);
this.lblDataP2.Location = new System.Drawing.Point(304, 15);
this.lblDataP2.Name = "lblDataP2";
this.lblDataP2.Size = new System.Drawing.Size(24, 11);
this.lblDataP2.TabIndex = 11;
@@ -123,7 +123,7 @@
this.lblDataP3.BackColor = System.Drawing.Color.LightGray;
this.lblDataP3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.lblDataP3.Font = new System.Drawing.Font("Microsoft Sans Serif", 6F, System.Drawing.FontStyle.Bold);
this.lblDataP3.Location = new System.Drawing.Point(395, 15);
this.lblDataP3.Location = new System.Drawing.Point(328, 15);
this.lblDataP3.Name = "lblDataP3";
this.lblDataP3.Size = new System.Drawing.Size(21, 11);
this.lblDataP3.TabIndex = 12;
@@ -135,74 +135,70 @@
this.tmrBusy.Interval = 1000;
this.tmrBusy.Tick += new System.EventHandler(this.tmrBusy_Tick);
//
// lblFlowTest
// lblPcbId
//
this.lblFlowTest.AutoSize = true;
this.lblFlowTest.BackColor = System.Drawing.Color.LightGray;
this.lblFlowTest.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.lblFlowTest.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold);
this.lblFlowTest.Location = new System.Drawing.Point(142, 1);
this.lblFlowTest.Name = "lblFlowTest";
this.lblFlowTest.Size = new System.Drawing.Size(24, 22);
this.lblFlowTest.TabIndex = 14;
this.lblFlowTest.Text = "H";
this.lblPcbId.AutoSize = true;
this.lblPcbId.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblPcbId.Location = new System.Drawing.Point(3, 19);
this.lblPcbId.Name = "lblPcbId";
this.lblPcbId.Size = new System.Drawing.Size(79, 15);
this.lblPcbId.TabIndex = 21;
this.lblPcbId.Text = "000000000";
this.lblPcbId.Click += new System.EventHandler(this.lblPcbId_Click_1);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(3, 6);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(48, 13);
this.label1.TabIndex = 24;
this.label1.Text = "PCBID:";
//
// lblPreadjustment
//
this.lblPreadjustment.AutoSize = true;
this.lblPreadjustment.BackColor = System.Drawing.Color.LightGray;
this.lblPreadjustment.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.lblPreadjustment.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold);
this.lblPreadjustment.Location = new System.Drawing.Point(120, 1);
this.lblPreadjustment.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblPreadjustment.Location = new System.Drawing.Point(98, 23);
this.lblPreadjustment.Name = "lblPreadjustment";
this.lblPreadjustment.Size = new System.Drawing.Size(23, 22);
this.lblPreadjustment.Size = new System.Drawing.Size(156, 18);
this.lblPreadjustment.TabIndex = 15;
this.lblPreadjustment.Text = "V";
this.lblPreadjustment.Text = "Preadjustment Status";
//
// label1
// label2
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.LightGray;
this.label1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold);
this.label1.Location = new System.Drawing.Point(3, 4);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(23, 22);
this.label1.TabIndex = 22;
this.label1.Text = "S";
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(256, 28);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(35, 13);
this.label2.TabIndex = 26;
this.label2.Text = "LUT:";
//
// lblPcbId
// lblLut
//
this.lblPcbId.AutoSize = true;
this.lblPcbId.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblPcbId.Location = new System.Drawing.Point(29, 5);
this.lblPcbId.Name = "lblPcbId";
this.lblPcbId.Size = new System.Drawing.Size(79, 15);
this.lblPcbId.TabIndex = 21;
this.lblPcbId.Text = "000000000";
this.lblLut.AutoSize = true;
this.lblLut.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblLut.Location = new System.Drawing.Point(297, 28);
this.lblLut.Name = "lblLut";
this.lblLut.Size = new System.Drawing.Size(11, 13);
this.lblLut.TabIndex = 27;
this.lblLut.Text = "-";
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.button1.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button1.Location = new System.Drawing.Point(422, -2);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(28, 33);
this.button1.TabIndex = 23;
this.button1.Text = "►";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// ctlEasyMeterRdy
// ctlCRdy
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.Controls.Add(this.button1);
this.Controls.Add(this.lblLut);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.lblPcbId);
this.Controls.Add(this.lblPreadjustment);
this.Controls.Add(this.lblFlowTest);
this.Controls.Add(this.lblDataP3);
this.Controls.Add(this.lblDataP2);
this.Controls.Add(this.lblDataP1);
@@ -210,8 +206,8 @@
this.Controls.Add(this.lblDataOverall);
this.Controls.Add(this.lblLed);
this.Controls.Add(this.lblLogin);
this.Name = "ctlEasyMeterRdy";
this.Size = new System.Drawing.Size(452, 30);
this.Name = "ctlCRdy";
this.Size = new System.Drawing.Size(350, 45);
this.Load += new System.EventHandler(this.ctlMeterReady_Load);
this.MouseEnter += new System.EventHandler(this.ctlEasyMeterRdy_MouseEnter);
this.MouseLeave += new System.EventHandler(this.ctlEasyMeterRdy_MouseLeave);
@@ -229,10 +225,10 @@
private System.Windows.Forms.Label lblDataP2;
private System.Windows.Forms.Label lblDataP3;
private System.Windows.Forms.Timer tmrBusy;
private System.Windows.Forms.Label lblFlowTest;
private System.Windows.Forms.Label lblPreadjustment;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label lblPcbId;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label lblPreadjustment;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label lblLut;
}
}
@@ -22,10 +22,10 @@ using XylemCommonUiLegacyGenCtl.Enums;
namespace XylemCommonUiLegacyGenCtl
{
[Guid("532F05D1-3317-4f00-B5D9-6CBB208B6B58")]
[ComSourceInterfaces(typeof(IEasyMeterRdy))]
[Guid("532F05D1-3317-4f00-B5D9-6CBB209B6B58")]
[ComSourceInterfaces(typeof(ICRdy))]
[ComVisible(true)]
public partial class ctlEasyMeterRdy : UserControl, IEasyMeterRdy
public partial class ctlCRdy : UserControl, ICRdy
{
public event OnPop Expand;
public event OnStateChange StateChange;
@@ -65,27 +65,82 @@ namespace XylemCommonUiLegacyGenCtl
private GenesisMeter meter;
public string SerialNumber { get; set; }
public string OrderNumber { get; set; }
public string RadioAdress { get; set; }
public string CustomerSerialNr { get; set; }
public string CalibrationRun { get; set; }
public int LastTestBechState { get; set; }
public string LastLUT { get; set; }
public bool DetectIsDone { get; set; }
public MeterSize Metersize { get; set; } = MeterSize.NAN;
public ctlEasyMeterRdy(int v)
private System.Windows.Forms.ToolTip ToolTip1 = new System.Windows.Forms.ToolTip();
public bool GetAllInfos(out string oPcbId, out string oSerialNumber, out bool oHasPreajustment, out bool oHasWarnings, out string oLUT)
{
oPcbId = "";
oSerialNumber = "";
oHasPreajustment = false;
oHasWarnings = true;
oLUT = "";
if (string.IsNullOrEmpty(PcbId) || PcbId == "-")
{
return true;
}
if (!string.IsNullOrEmpty(LastLUT) || LastLUT == "-")
{
oLUT = LastLUT;
}
else
{
oLUT = "na";
}
oPcbId = PcbId;
oSerialNumber = SerialNumber;
if (FlowState == MeterReadyResults.OnlyValidRecords
&& Path1State == MeterReadyResults.OnlyValidRecords
&& Path2State == MeterReadyResults.OnlyValidRecords
&& Path3State == MeterReadyResults.OnlyValidRecords
)
{
oHasWarnings = false;
}
if (!string.IsNullOrEmpty(CalibrationRun))
{
oHasPreajustment = true;
}
return DetectIsDone;
}
public ctlCRdy()
{
}
public ctlCRdy(int v)
{
}
public void Init(int v)
{
SetSlot(v);
InitializeComponent();
button1.Text = "►";
this.Width = 140;
var vis = false;
var vis = true;
lblPreadjustment.Visible = vis;
lblFlowTest.Visible = vis;
lblLogin.Visible = vis;
lblLed.Visible = vis;
lblDataOverall.Visible = vis;
@@ -93,6 +148,7 @@ namespace XylemCommonUiLegacyGenCtl
lblDataP1.Visible = vis;
lblDataP2.Visible = vis;
lblDataP3.Visible = vis;
}
@@ -101,8 +157,6 @@ namespace XylemCommonUiLegacyGenCtl
{
if (NewState != currentState)
{
currentState = NewState;
OnStateChanged?.Invoke(currentState, EventArgs.Empty);
@@ -133,6 +187,7 @@ namespace XylemCommonUiLegacyGenCtl
lblDataP1.BackColor = NonColor;
lblDataP2.BackColor = NonColor;
lblDataP3.BackColor = NonColor;
lblLut.Text = LastLUT;
if (newState == TaskState.LoginInProgress)
{
lblLogin.BackColor = CurrentColor;
@@ -188,6 +243,7 @@ namespace XylemCommonUiLegacyGenCtl
}
@@ -197,8 +253,6 @@ namespace XylemCommonUiLegacyGenCtl
{
changeCurrentSlotState(TaskState.SetSlot);
meterSlot = key;
overallMeterBatch = new MeterBatch();
}
private Color MeterStateToColor(MeterReadyResults state)
@@ -237,32 +291,23 @@ namespace XylemCommonUiLegacyGenCtl
if (Preadjustment.Value)
{
lblPreadjustment.BackColor = DoneColor;
ToolTip1.SetToolTip(lblPreadjustment, "Ein erfolgreiches Preadjustment gefunden Zähler kann geprüft werden");
}
else
{
lblPreadjustment.BackColor = ErrorColor;
ToolTip1.SetToolTip(lblPreadjustment, "Preadjustment nicht erfolgreich");
}
}
else
{
lblPreadjustment.BackColor = NonColor;
ToolTip1.SetToolTip(lblPreadjustment, "Kein Preadjustment für diesen Zähler gefunden");
}
if (FlowTest.HasValue)
{
if (FlowTest.Value)
{
lblFlowTest.BackColor = DoneColor;
}
else
{
lblFlowTest.BackColor = ErrorColor;
}
}
else
{
lblFlowTest.BackColor = NonColor;
}
lblLut.Text = LastLUT;
}
@@ -276,7 +321,7 @@ namespace XylemCommonUiLegacyGenCtl
{
var responseJson = LocalWebRequest.GetRequest($"{ServiceUrls.MeterInfoForTestBench()}{PcbId}");
var a = JsonConvert.DeserializeObject<string[]>(responseJson);
var SerialNumber = a[0];
SerialNumber = a[0];
if (!String.IsNullOrEmpty(SerialNumber))
{
OrderNumber = a[1];
@@ -330,24 +375,33 @@ namespace XylemCommonUiLegacyGenCtl
private CancellationTokenSource CancellationTokenSource = new CancellationTokenSource();
public void Start()
{
Start(false);
}
public void Start(bool forceDisplayClear = false)
public void Start(bool forceDisplayClear)
{
if (!isBusy)
{
DetectIsDone = false;
this.BackColor = Color.LightYellow;
var t = new Task(() =>
{
var ctlCancellationToken = CancellationTokenSource.Token;
using (var overallMeterBatch = new MeterBatch("Start ctlRdy"))
{
using (var meter = new GenesisMeter())
{
var ctlCancellationToken = CancellationTokenSource.Token;
LastLUT = "-";
try
{
var settingsToUse = new DefaultSettings();
meter = new GenesisMeter();
meter.SetupFromConfigFile(meterSlot, false, true, true);
overallMeterBatch.AddMeter(meter);
@@ -397,6 +451,8 @@ namespace XylemCommonUiLegacyGenCtl
if (!string.IsNullOrEmpty(meter.PcbId) && meter.Login())
{
changeCurrentSlotState(TaskState.LoginDone);
LastLUT = meter.LutCrc;
if (ctlCancellationToken.IsCancellationRequested)
{
return;
@@ -465,6 +521,7 @@ namespace XylemCommonUiLegacyGenCtl
if (currentState == TaskState.LedInProgress)
{
changeCurrentSlotState(TaskState.LedFailed);
DetectIsDone = true;
}
else
{
@@ -486,6 +543,7 @@ namespace XylemCommonUiLegacyGenCtl
{
changeCurrentSlotState(TaskState.MessurementDoneWithHint);
}
DetectIsDone = true;
}
@@ -493,23 +551,25 @@ namespace XylemCommonUiLegacyGenCtl
else
{
changeCurrentSlotState(TaskState.LoginFailed);
DetectIsDone = true;
}
}
}
catch (Exception ex)
{
PcbId = "";
DetectIsDone = true;
MessageBox.Show(ex.Message + ex.StackTrace, "Error on check meter is ready");
}
finally
{
isBusy = false;
overallMeterBatch.RemoveMeter(meter);
meter?.Dispose();
}
}
}
});
t.Start();
}
@@ -583,7 +643,7 @@ namespace XylemCommonUiLegacyGenCtl
private bool Light = false;
private MeterBatch overallMeterBatch;
private int meterSlot;
private void tmrBusy_Tick(object sender, EventArgs e)
@@ -679,40 +739,8 @@ namespace XylemCommonUiLegacyGenCtl
//
}
private void button1_Click(object sender, EventArgs e)
private void lblPcbId_Click_1(object sender, EventArgs e)
{
var vis = false;
//"◄►"
if (button1.Text == "►")
{
this.Width = 450;
Expand?.Invoke(sender, new PopEventArgs() { Show = true });
button1.Text = "◄";
vis = true;
}
else
{
this.Width = 140;
Expand?.Invoke(sender, new PopEventArgs() { Show = false });
button1.Text = "►";
this.Width = 140;
vis = false;
}
lblPreadjustment.Visible = vis;
lblFlowTest.Visible = vis;
lblLogin.Visible = vis;
lblLed.Visible = vis;
lblDataOverall.Visible = vis;
lblDataDisplay.Visible = vis;
lblDataP1.Visible = vis;
lblDataP2.Visible = vis;
lblDataP3.Visible = vis;
}
}