TURA_IPERL || TURA_SPECIAL : TracingResultsDlg shown after a double-click on a WM results.

This commit is contained in:
Milan Hanajik 2019-06-04 15:32:36 +02:00
parent dfd8e879d1
commit 05bdf0dc06
14 changed files with 542 additions and 15 deletions

View File

@ -9,6 +9,8 @@ using System.Windows.Forms;
using log4net;
using Config.Entities;
using Results.Resources;
using NHibernate;
using TracingDB.Entities;
namespace Results.Forms
{
@ -171,6 +173,20 @@ namespace Results.Forms
firstListView = lview;
first = false;
}
#if TURA_IPERL || TURA_SPECIAL
lview.WMResultsClickedHandler += delegate(object sender, Results.Forms.WaterMeterEventArgs args)
{
if (InvokeRequired)
{
Invoke(new EventHandler<Results.Forms.WaterMeterEventArgs>(OnDoubleClick), sender, args);
}
else
{
OnDoubleClick(sender, args);
}
};
#endif
}
}
}
@ -193,11 +209,11 @@ namespace Results.Forms
/// Get an empty ListView control with appropriate parameters.
/// </summary>
/// <returns>ListView control</returns>
OneWMResultsCtrl GetListView(Color backColor)
OneWMResultsCtrl GetListView(Color backColor, Results.Entities.WaterMeter wm)
{
return new OneWMResultsCtrl(backColor, lvWidth, lvHeight);
return new OneWMResultsCtrl(backColor, lvWidth, lvHeight, wm);
}
OneWMResultsCtrl GetListView() { return GetListView(Color.White); }
OneWMResultsCtrl GetListView(Results.Entities.WaterMeter wm) { return GetListView(Color.White, wm); }
/// <summary>
@ -286,7 +302,7 @@ namespace Results.Forms
string message = string.Empty;
Color commonBackColor = GetColorOfResults(wMtr, out message);
OneWMResultsCtrl lview = GetListView(commonBackColor);
OneWMResultsCtrl lview = GetListView(commonBackColor, wMtr);
#if ORACLE_DB
lview.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
#else
@ -358,7 +374,7 @@ namespace Results.Forms
string message;
Color commonBackColor = GetColorOfResults(wMtr, out message);
OneWMResultsCtrl lview = GetListView(commonBackColor);
OneWMResultsCtrl lview = GetListView(commonBackColor, wMtr);
#if ORACLE_DB
lview.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
#else
@ -414,6 +430,56 @@ namespace Results.Forms
return lview;
}
void OnDoubleClick(object sender, Results.Forms.WaterMeterEventArgs args)
{
Results.Entities.WaterMeter wm = args.WM;
if (wm == null || wm.Disabled || string.IsNullOrEmpty(wm.SerialNr))
{
MessageBox.Show("No water meter or missing S/N");
}
else if (TracingDB.DB.SessionFactory == null)
{
MessageBox.Show("No access to tracing database");
}
else
{
using (ISession session = TracingDB.DB.SessionFactory.OpenSession())
{
IList<ReferenceRecord> refRecords = session.QueryOver<ReferenceRecord>()
.Where(x => (x.Code == wm.SerialNr))
.OrderBy(x => x.TimeStamp).Desc
.List();
for (int i = 0; i < refRecords.Count; i++)
{
ReferenceRecord refR = refRecords[i];
if ((refR.Records != null) && (refR.Records.Count > 0))
{
/// Reference record has additional records/parts (i.e. it is PCB assembly workflow step)
///
foreach (var rec in refR.Records)
{
if (rec.Part.OraDBType.ToLower().Contains("flowtube"))
{
/// rec.Part is a flowtube
///
IList<ReferenceRecord> flowtubeRRs = session.QueryOver<ReferenceRecord>()
.Where(x => (x.Code == rec.Code))
.OrderBy(x => x.TimeStamp).Desc
.List();
foreach (var rr in flowtubeRRs) refRecords.Add(rr);
}
}
}
}
new Results.Forms.TracingResultsDlg(refRecords).ShowDialog();
}
}
}
private void BatchResultsDlg_FormClosing(object sender, FormClosingEventArgs e)
{
PopupResultsLeft = Left;

View File

@ -64,6 +64,7 @@
this.tBox.Name = "tBox";
this.tBox.Size = new System.Drawing.Size(352, 20);
this.tBox.TabIndex = 0;
this.tBox.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.tBox_MouseDoubleClick);
//
// lView
//

View File

@ -1,26 +1,41 @@
using System.Drawing;
using System;
using System.Drawing;
using System.Windows.Forms;
using log4net;
namespace Results.Forms
{
public partial class OneWMResultsCtrl : UserControl
{
static readonly ILog log = LogManager.GetLogger(typeof(OneWMResultsCtrl));
public event EventHandler<WaterMeterEventArgs> WMResultsClickedHandler;
public OneWMResultsCtrl()
{
InitializeComponent();
}
public OneWMResultsCtrl(Color backColor, int lvWidth, int lvHeight)
public OneWMResultsCtrl(Color backColor, int lvWidth, int lvHeight, Results.Entities.WaterMeter wm)
: this()
{
lView.BackColor = backColor;
tBox.BackColor = backColor;
Size = new System.Drawing.Size(lvWidth, lvHeight);
WM = wm;
}
public Results.Entities.WaterMeter WM;
public string Caption { get { return tBox.Text; } set { tBox.Text = value; } }
public ListView.ColumnHeaderCollection Columns { get { return lView.Columns; } }
public ListView.ListViewItemCollection Items { get { return lView.Items; } }
public Color BColor { set { lView.BackColor = value; tBox.BackColor = value; } }
private void tBox_MouseDoubleClick(object sender, MouseEventArgs e)
{
if (WMResultsClickedHandler == null) return;
try { WMResultsClickedHandler(sender, new WaterMeterEventArgs(WM)); }
catch (Exception exc) { log.Error("WMResultsClickedHandler(...) failed", exc); }
}
}
}

View File

@ -0,0 +1,65 @@
namespace Results.Forms
{
partial class TracingResultsDlg
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.tracingResultsListView = new System.Windows.Forms.ListView();
this.SuspendLayout();
//
// tracingResultsListView
//
this.tracingResultsListView.Dock = System.Windows.Forms.DockStyle.Fill;
this.tracingResultsListView.GridLines = true;
this.tracingResultsListView.Location = new System.Drawing.Point(0, 0);
this.tracingResultsListView.Name = "tracingResultsListView";
this.tracingResultsListView.Size = new System.Drawing.Size(1228, 178);
this.tracingResultsListView.TabIndex = 0;
this.tracingResultsListView.UseCompatibleStateImageBehavior = false;
this.tracingResultsListView.View = System.Windows.Forms.View.Details;
//
// TracingResultsDlg
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1228, 178);
this.Controls.Add(this.tracingResultsListView);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "TracingResultsDlg";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "TracingResultsDlg";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ListView tracingResultsListView;
}
}

View File

@ -0,0 +1,44 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using TracingDB.Entities;
using Results.Resources;
namespace Results.Forms
{
public partial class TracingResultsDlg : Form
{
public TracingResultsDlg(IList<ReferenceRecord> rRecords)
{
InitializeComponent();
Text = Strings.Production_tracing_results;
tracingResultsListView.Columns.Add(Strings.Date_and_time, 110);
tracingResultsListView.Columns.Add(Strings.Step, 100);
tracingResultsListView.Columns.Add(Strings.Workplace, 100);
tracingResultsListView.Columns.Add(Strings.Name, 100);
tracingResultsListView.Columns.Add(Strings.Result, 70);
tracingResultsListView.Columns.Add(Strings.Part, 90);
tracingResultsListView.Columns.Add(Strings.Code, 150);
tracingResultsListView.Columns.Add(Strings.Workflow, 450);
foreach (var rr in rRecords)
{
tracingResultsListView.Items.Add(new ListViewItem(new string[] {
rr.TimeStamp.ToString("dd.MM.yyyy HH:mm"),
rr.Workstep.Name,
rr.Workplace,
rr.UserName,
rr.Result == 0 ? "OK" : "NOK",
rr.Workstep.ReferencePart.Name,
rr.Code,
rr.Process.Name,
}));
}
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,14 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
namespace Results.Forms
{
public class WaterMeterEventArgs : EventArgs
{
public Results.Entities.WaterMeter WM;
public WaterMeterEventArgs(Results.Entities.WaterMeter wm) { WM = wm; }
}
}

View File

@ -186,6 +186,15 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Code.
/// </summary>
internal static string Code {
get {
return ResourceManager.GetString("Code", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Compound.
/// </summary>
@ -213,6 +222,15 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Date and time.
/// </summary>
internal static string Date_and_time {
get {
return ResourceManager.GetString("Date_and_time", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Density.
/// </summary>
@ -528,6 +546,15 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Name.
/// </summary>
internal static string Name {
get {
return ResourceManager.GetString("Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to No.
/// </summary>
@ -654,6 +681,15 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Part.
/// </summary>
internal static string Part {
get {
return ResourceManager.GetString("Part", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to OK.
/// </summary>
@ -735,6 +771,15 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Production tracing results.
/// </summary>
internal static string Production_tracing_results {
get {
return ResourceManager.GetString("Production_tracing_results", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Protocol.
/// </summary>
@ -987,6 +1032,15 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Step.
/// </summary>
internal static string Step {
get {
return ResourceManager.GetString("Step", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to T amb.
/// </summary>
@ -1986,6 +2040,24 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Workflow.
/// </summary>
internal static string Workflow {
get {
return ResourceManager.GetString("Workflow", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Workplace.
/// </summary>
internal static string Workplace {
get {
return ResourceManager.GetString("Workplace", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Wrong iPerl counting direction.
/// </summary>

View File

@ -279,4 +279,28 @@
<data name="Test_in_progress" xml:space="preserve">
<value>Probíhá test</value>
</data>
<data name="Date_and_time" xml:space="preserve">
<value>Datum a čas</value>
</data>
<data name="Name" xml:space="preserve">
<value>Jméno</value>
</data>
<data name="Step" xml:space="preserve">
<value>Krok</value>
</data>
<data name="Workplace" xml:space="preserve">
<value>Pracovisko</value>
</data>
<data name="Workflow" xml:space="preserve">
<value>Pracovný postup</value>
</data>
<data name="Production_tracing_results" xml:space="preserve">
<value>Výsledky sledování výroby</value>
</data>
<data name="Code" xml:space="preserve">
<value>Kód</value>
</data>
<data name="Part" xml:space="preserve">
<value>Součástka</value>
</data>
</root>

View File

@ -768,4 +768,28 @@
<data name="Counter_0" xml:space="preserve">
<value>Counter {0}</value>
</data>
<data name="Date_and_time" xml:space="preserve">
<value>Date and time</value>
</data>
<data name="Name" xml:space="preserve">
<value>Name</value>
</data>
<data name="Step" xml:space="preserve">
<value>Step</value>
</data>
<data name="Workplace" xml:space="preserve">
<value>Workplace</value>
</data>
<data name="Workflow" xml:space="preserve">
<value>Workflow</value>
</data>
<data name="Production_tracing_results" xml:space="preserve">
<value>Production tracing results</value>
</data>
<data name="Code" xml:space="preserve">
<value>Code</value>
</data>
<data name="Part" xml:space="preserve">
<value>Part</value>
</data>
</root>

View File

@ -98,6 +98,13 @@
<Compile Include="Forms\ResultsConfigDlg.designer.cs">
<DependentUpon>ResultsConfigDlg.cs</DependentUpon>
</Compile>
<Compile Include="Forms\TracingResultsDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\TracingResultsDlg.Designer.cs">
<DependentUpon>TracingResultsDlg.cs</DependentUpon>
</Compile>
<Compile Include="Forms\WaterMeterEventArgs.cs" />
<Compile Include="ItemID.cs" />
<Compile Include="Mappings\BatchMap.cs" />
<Compile Include="Mappings\ComponentsMap.cs" />
@ -148,6 +155,10 @@
<Project>{743DF7DB-C7B6-42EB-986D-0F485E5588E4}</Project>
<Name>Config</Name>
</ProjectReference>
<ProjectReference Include="..\TracingDB\TracingDB.csproj">
<Project>{EFEC8A31-3022-4DA7-A8F6-16D30A94C3FF}</Project>
<Name>TracingDB</Name>
</ProjectReference>
<ProjectReference Include="..\Users\Users.csproj">
<Project>{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}</Project>
<Name>Users</Name>
@ -174,6 +185,9 @@
<EmbeddedResource Include="Forms\ResultsConfigDlg.resx">
<DependentUpon>ResultsConfigDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\TracingResultsDlg.resx">
<DependentUpon>TracingResultsDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>

View File

@ -28,7 +28,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
{
ParentName = string.Empty;
Workplace = "WR10";
ConnStr = "SERVER=10.42.128.16; DATABASE=st_wr_shared_config; UID=u9305784; PASSWORD=p89344390; CHARSET=utf8;";
ConnStr = "SERVER=10.42.128.16; DATABASE=sledovanie2019; UID=vyroba2019; PASSWORD=qwerty; CHARSET=utf8;";
CheckPreviousRecords = true;
SaveTracingRecords = true;
}

View File

@ -62,7 +62,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
Results.Entities.Batch batch;
ISessionFactory sessionFactory; /// Factory to create database sessions that is initialized in the constructor
ISessionFactory sessionFactory; /// Factory to create database sessions that is initialized in the constructor
IList<Process> processes;
Dictionary<int, Process> processDictionary;
Dictionary<int, IList<Workstep>> workstepsDictionary;
@ -83,6 +83,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
: base(cfg)
{
tracingCfg = cfg as MonitoringCfg;
if (tracingCfg == null) throw new ArgumentException("tracingCfg");
currentOpState = OpState.None;
log.Debug(this.ToString());
}
@ -116,6 +117,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
DateTime.Now + new TimeSpan(15, 0, 0, 0));
session.Flush();
session.Close();
TracingDB.DB.SessionFactory = sessionFactory;
if (session != null) session.Dispose();
currentProcess = null;

View File

@ -13,6 +13,8 @@ using Config.Entities;
using TBF.Resources;
using TBF.UiBridge;
using Results.Forms;
using TracingDB.Entities;
using NHibernate;
namespace TBF.Screens
{
@ -308,6 +310,20 @@ namespace TBF.Screens
firstListView = lview;
first = false;
}
#if TURA_IPERL || TURA_SPECIAL
lview.WMResultsClickedHandler += delegate(object sender, Results.Forms.WaterMeterEventArgs args)
{
if (InvokeRequired)
{
Invoke(new EventHandler<Results.Forms.WaterMeterEventArgs>(OnDoubleClick), sender, args);
}
else
{
OnDoubleClick(sender, args);
}
};
#endif
}
}
}
@ -325,15 +341,16 @@ namespace TBF.Screens
this.ResumeLayout(false);
}
/// <summary>
/// Get an empty ListView control with appropriate parameters.
/// </summary>
/// <returns>ListView control</returns>
OneWMResultsCtrl GetListView(Color backColor)
OneWMResultsCtrl GetListView(Color backColor, Results.Entities.WaterMeter wm)
{
return new OneWMResultsCtrl(backColor, lvWidth, lvHeight);
return new OneWMResultsCtrl(backColor, lvWidth, lvHeight, wm);
}
OneWMResultsCtrl GetListView() { return GetListView(Color.White); }
OneWMResultsCtrl GetListView(Results.Entities.WaterMeter wm) { return GetListView(Color.White, wm); }
/// <summary>
@ -434,7 +451,7 @@ namespace TBF.Screens
string message = string.Empty;
Color commonBackColor = GetColorOfResults(wMtr, out message);
OneWMResultsCtrl lview = GetListView(commonBackColor);
OneWMResultsCtrl lview = GetListView(commonBackColor, wMtr);
#if ORACLE_DB
lview.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
#else
@ -512,7 +529,7 @@ namespace TBF.Screens
string message;
Color commonBackColor = GetColorOfResults(wMtr, out message);
OneWMResultsCtrl lview = GetListView(commonBackColor);
OneWMResultsCtrl lview = GetListView(commonBackColor, wMtr);
#if ORACLE_DB
lview.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
#else
@ -594,5 +611,54 @@ namespace TBF.Screens
}
RedrawAll(TBF.BenchControl.Sequences.ProcessData.BatchRslts);
}
}
void OnDoubleClick(object sender, Results.Forms.WaterMeterEventArgs args)
{
Results.Entities.WaterMeter wm = args.WM;
if (wm == null || wm.Disabled || string.IsNullOrEmpty(wm.SerialNr))
{
MessageBox.Show("No water meter or missing S/N");
}
else if (TracingDB.DB.SessionFactory == null)
{
MessageBox.Show("No access to tracing database");
}
else
{
using (ISession session = TracingDB.DB.SessionFactory.OpenSession())
{
IList<ReferenceRecord> refRecords = session.QueryOver<ReferenceRecord>()
.Where(x => (x.Code == wm.SerialNr))
.OrderBy(x => x.TimeStamp).Desc
.List();
for (int i = 0; i < refRecords.Count; i++)
{
ReferenceRecord refR = refRecords[i];
if ((refR.Records != null) && (refR.Records.Count > 0))
{
/// Reference record has additional records/parts (i.e. it is PCB assembly workflow step)
///
foreach (var rec in refR.Records)
{
if (rec.Part.OraDBType.ToLower().Contains("flowtube"))
{
/// rec.Part is a flowtube
///
IList<ReferenceRecord> flowtubeRRs = session.QueryOver<ReferenceRecord>()
.Where(x => (x.Code == rec.Code))
.OrderBy(x => x.TimeStamp).Desc
.List();
foreach (var rr in flowtubeRRs) refRecords.Add(rr);
}
}
}
}
new Results.Forms.TracingResultsDlg(refRecords).ShowDialog();
}
}
}
}
}