All changes - collect cammera, fixed pictures preview, collecting pictures - 48 meters to grab data

This commit is contained in:
Michal Buzik 2024-08-30 10:22:57 +02:00
parent 97e0a764b8
commit a4360f6993
41 changed files with 17511 additions and 279 deletions

View File

@ -85,6 +85,9 @@
<Compile Include="Entities\Procedure.cs" />
<Compile Include="Entities\Profile.cs" />
<Compile Include="Entities\PTest.cs" />
<Compile Include="Entities\PurchaseEntities\PurchaseBox.cs" />
<Compile Include="Entities\PurchaseEntities\PurchaseOrder.cs" />
<Compile Include="Entities\PurchaseEntities\PurchaseWaterMeterData.cs" />
<Compile Include="Entities\Test.cs" />
<Compile Include="Entities\TestInstance.cs" />
<Compile Include="Entities\TransitionSequence.cs" />
@ -109,12 +112,15 @@
<Compile Include="Mappings\ProcedureMap.cs" />
<Compile Include="Mappings\ProfileMap.cs" />
<Compile Include="Mappings\PTestMap.cs" />
<Compile Include="Mappings\PurchaseBoxMap.cs" />
<Compile Include="Mappings\PurchaseOrderMap.cs" />
<Compile Include="Mappings\TestMap.cs" />
<Compile Include="Mappings\TransitionSequenceMap.cs" />
<Compile Include="Mappings\TransitionStepMap.cs" />
<Compile Include="Mappings\UncertaintyMap.cs" />
<Compile Include="Mappings\UserMap.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="PurchaseResources.cs" />
<Compile Include="Resources\Strings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>

View File

@ -0,0 +1,27 @@
using System.Collections.Generic;
namespace Config.Entities.PurchaseEntities
{
public class PurchaseBox
{
public virtual int Id { get; protected set; }
public virtual string BoxNo { get; set; }
public virtual int BoxData_Id { get; set; }
public virtual PurchaseOrder PurchaseOrder { get; set; }
public virtual List<PurchaseWaterMeterData> PurchaseWaterMeterDataList { get; set; }
public PurchaseBox()
{
PurchaseWaterMeterDataList = new List<PurchaseWaterMeterData>();
}
public PurchaseBox(string boxNo, int boxDataId, PurchaseOrder purchaseOrder)
{
PurchaseWaterMeterDataList = new List<PurchaseWaterMeterData>();
BoxNo = boxNo;
BoxData_Id = boxDataId;
PurchaseOrder = purchaseOrder;
}
}
}

View File

@ -0,0 +1,23 @@
using System.Collections.Generic;
using System.ComponentModel;
namespace Config.Entities.PurchaseEntities
{
public class PurchaseOrder
{
public virtual int Id { get; protected set; }
public virtual string Name { get; set; }
public virtual IList<PurchaseBox> PurchaseBoxList { get; set; }
public PurchaseOrder()
{
PurchaseBoxList = new List<PurchaseBox>();
}
public PurchaseOrder(string name)
{
PurchaseBoxList = new List<PurchaseBox>();
Name = name;
}
}
}

View File

@ -0,0 +1,23 @@
using System.Collections.Generic;
namespace Config.Entities.PurchaseEntities
{
public class PurchaseWaterMeterData
{
public virtual int Id { get; protected set; }
public virtual string SerialNo { get; set; }
public virtual PurchaseBox PurchaseBox { get; set; }
public virtual int WaterMeterResults { get; set; }
public PurchaseWaterMeterData()
{
}
public PurchaseWaterMeterData(string serialNo, PurchaseBox purchaseBox)
{
SerialNo = serialNo;
PurchaseBox = purchaseBox;
}
}
}

View File

@ -0,0 +1,19 @@
using Config.Entities.PurchaseEntities;
using FluentNHibernate.Mapping;
namespace Config.Mappings
{
public class PurchaseBoxMap : ClassMap<Entities.PurchaseEntities.PurchaseBox>
{
public PurchaseBoxMap()
{
Table("purchase_boxdata");
Id(x => x.Id);
Map(x => x.BoxNo);
Map(x => x.BoxData_Id);
References<PurchaseOrder>(x => x.PurchaseOrder);
}
}
}

View File

@ -0,0 +1,20 @@
using Config.Entities.PurchaseEntities;
using FluentNHibernate.Mapping;
using NHibernate.Mapping;
namespace Config.Mappings
{
public class PurchaseOrderMap : ClassMap<Entities.PurchaseEntities.PurchaseOrder>
{
public PurchaseOrderMap()
{
Table("purchase_orderdata");
Id(x => x.Id);
Map(x => x.Name).Column("PurchaseOrder");
HasMany<PurchaseBox>(x => x.PurchaseBoxList)
.Cascade.All()
.KeyColumn("BoxData_Id");
}
}
}

View File

@ -0,0 +1,7 @@
namespace Config
{
public class PurchaseResources
{
}
}

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.9.2141.1")]
[assembly: AssemblyFileVersion("3.9.2141.1")]
[assembly: AssemblyVersion("3.9.2142.9")]
[assembly: AssemblyFileVersion("3.9.2142.9")]

View File

@ -82,7 +82,7 @@ namespace TBF.Rig.DataEntry.StandardCamera
if (hideOrder) orderGroupBox.Visible = false;
Height = 155 + lineSize * 44;
this.Height = 155 + lineSize * 44;
}
/// <summary>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,276 @@
<?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>
<data name="okButton.Text" xml:space="preserve">
<value>OK</value>
</data>
<data name="orderGroupBox.Text" xml:space="preserve">
<value>Kolejność</value>
</data>
<data name="clearButton.Text" xml:space="preserve">
<value>Usunąć</value>
</data>
<data name="label1.Text" xml:space="preserve">
<value>Nr seryjny 1</value>
</data>
<data name="label2.Text" xml:space="preserve">
<value>Nr seryjny 2</value>
</data>
<data name="label3.Text" xml:space="preserve">
<value>Nr seryjny 3</value>
</data>
<data name="label4.Text" xml:space="preserve">
<value>Nr seryjny 4</value>
</data>
<data name="label5.Text" xml:space="preserve">
<value>Nr seryjny 5</value>
</data>
<data name="label6.Text" xml:space="preserve">
<value>Nr seryjny 6</value>
</data>
<data name="label7.Text" xml:space="preserve">
<value>Nr seryjny 7</value>
</data>
<data name="label8.Text" xml:space="preserve">
<value>Nr seryjny 8</value>
</data>
<data name="label9.Text" xml:space="preserve">
<value>Nr seryjny 9</value>
</data>
<data name="label10.Text" xml:space="preserve">
<value>Nr seryjny 10</value>
</data>
<data name="label11.Text" xml:space="preserve">
<value>Nr seryjny 11</value>
</data>
<data name="label12.Text" xml:space="preserve">
<value>Nr seryjny 12</value>
</data>
<data name="label13.Text" xml:space="preserve">
<value>Nr seryjny 13</value>
</data>
<data name="label14.Text" xml:space="preserve">
<value>Nr seryjny 14</value>
</data>
<data name="label15.Text" xml:space="preserve">
<value>Nr seryjny 15</value>
</data>
<data name="label16.Text" xml:space="preserve">
<value>Nr seryjny 16</value>
</data>
<data name="label17.Text" xml:space="preserve">
<value>Nr seryjny 17</value>
</data>
<data name="label18.Text" xml:space="preserve">
<value>Nr seryjny 18</value>
</data>
<data name="label19.Text" xml:space="preserve">
<value>Nr seryjny 19</value>
</data>
<data name="label20.Text" xml:space="preserve">
<value>Nr seryjny 20</value>
</data>
<data name="label21.Text" xml:space="preserve">
<value>Nr seryjny 21</value>
</data>
<data name="label22.Text" xml:space="preserve">
<value>Nr seryjny 22</value>
</data>
<data name="label23.Text" xml:space="preserve">
<value>Nr seryjny 23</value>
</data>
<data name="label24.Text" xml:space="preserve">
<value>Nr seryjny 24</value>
</data>
<data name="label48.Text" xml:space="preserve">
<value>Nr seryjny 48</value>
</data>
<data name="label47.Text" xml:space="preserve">
<value>Nr seryjny 47</value>
</data>
<data name="label46.Text" xml:space="preserve">
<value>Nr seryjny 46</value>
</data>
<data name="label45.Text" xml:space="preserve">
<value>Nr seryjny 45</value>
</data>
<data name="label44.Text" xml:space="preserve">
<value>Nr seryjny 44</value>
</data>
<data name="label43.Text" xml:space="preserve">
<value>Nr seryjny 43</value>
</data>
<data name="label42.Text" xml:space="preserve">
<value>Nr seryjny 42</value>
</data>
<data name="label41.Text" xml:space="preserve">
<value>Nr seryjny 41</value>
</data>
<data name="label40.Text" xml:space="preserve">
<value>Nr seryjny 40</value>
</data>
<data name="label39.Text" xml:space="preserve">
<value>Nr seryjny 39</value>
</data>
<data name="label38.Text" xml:space="preserve">
<value>Nr seryjny 38</value>
</data>
<data name="label37.Text" xml:space="preserve">
<value>Nr seryjny 37</value>
</data>
<data name="label36.Text" xml:space="preserve">
<value>Nr seryjny 36</value>
</data>
<data name="label35.Text" xml:space="preserve">
<value>Nr seryjny 35</value>
</data>
<data name="label34.Text" xml:space="preserve">
<value>Nr seryjny 34</value>
</data>
<data name="label33.Text" xml:space="preserve">
<value>Nr seryjny 16</value>
</data>
<data name="label32.Text" xml:space="preserve">
<value>Nr seryjny 17</value>
</data>
<data name="label31.Text" xml:space="preserve">
<value>Nr seryjny 18</value>
</data>
<data name="label30.Text" xml:space="preserve">
<value>Nr seryjny 19</value>
</data>
<data name="label29.Text" xml:space="preserve">
<value>Nr seryjny 20</value>
</data>
<data name="label28.Text" xml:space="preserve">
<value>Nr seryjny 21</value>
</data>
<data name="label27.Text" xml:space="preserve">
<value>Nr seryjny 22</value>
</data>
<data name="label26.Text" xml:space="preserve">
<value>Nr seryjny 23</value>
</data>
<data name="label25.Text" xml:space="preserve">
<value>Nr seryjny 24</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>Dane partii</value>
</data>
</root>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,276 @@
<?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>
<data name="okButton.Text" xml:space="preserve">
<value>OK</value>
</data>
<data name="orderGroupBox.Text" xml:space="preserve">
<value>Порядок</value>
</data>
<data name="clearButton.Text" xml:space="preserve">
<value>Очистить</value>
</data>
<data name="label1.Text" xml:space="preserve">
<value>Серийный номер 1</value>
</data>
<data name="label2.Text" xml:space="preserve">
<value>Серийный номер 2</value>
</data>
<data name="label3.Text" xml:space="preserve">
<value>Серийный номер 3</value>
</data>
<data name="label4.Text" xml:space="preserve">
<value>Серийный номер 4</value>
</data>
<data name="label5.Text" xml:space="preserve">
<value>Серийный номер 5</value>
</data>
<data name="label6.Text" xml:space="preserve">
<value>Серийный номер 6</value>
</data>
<data name="label7.Text" xml:space="preserve">
<value>Серийный номер 7</value>
</data>
<data name="label8.Text" xml:space="preserve">
<value>Серийный номер 8</value>
</data>
<data name="label9.Text" xml:space="preserve">
<value>Серийный номер 9</value>
</data>
<data name="label10.Text" xml:space="preserve">
<value>Серийный номер 10</value>
</data>
<data name="label11.Text" xml:space="preserve">
<value>Серийный номер 11</value>
</data>
<data name="label12.Text" xml:space="preserve">
<value>Серийный номер 12</value>
</data>
<data name="label13.Text" xml:space="preserve">
<value>Серийный номер 13</value>
</data>
<data name="label14.Text" xml:space="preserve">
<value>Серийный номер 14</value>
</data>
<data name="label15.Text" xml:space="preserve">
<value>Серийный номер 15</value>
</data>
<data name="label16.Text" xml:space="preserve">
<value>Серийный номер 16</value>
</data>
<data name="label17.Text" xml:space="preserve">
<value>Серийный номер 17</value>
</data>
<data name="label18.Text" xml:space="preserve">
<value>Серийный номер 18</value>
</data>
<data name="label19.Text" xml:space="preserve">
<value>Серийный номер 19</value>
</data>
<data name="label20.Text" xml:space="preserve">
<value>Серийный номер 20</value>
</data>
<data name="label21.Text" xml:space="preserve">
<value>Серийный номер 21</value>
</data>
<data name="label22.Text" xml:space="preserve">
<value>Серийный номер 22</value>
</data>
<data name="label23.Text" xml:space="preserve">
<value>Серийный номер 23</value>
</data>
<data name="label24.Text" xml:space="preserve">
<value>Серийный номер 24</value>
</data>
<data name="label48.Text" xml:space="preserve">
<value>Серийный номер 48</value>
</data>
<data name="label47.Text" xml:space="preserve">
<value>Серийный номер 47</value>
</data>
<data name="label46.Text" xml:space="preserve">
<value>Серийный номер 46</value>
</data>
<data name="label45.Text" xml:space="preserve">
<value>Серийный номер 45</value>
</data>
<data name="label44.Text" xml:space="preserve">
<value>Серийный номер 44</value>
</data>
<data name="label43.Text" xml:space="preserve">
<value>Серийный номер 43</value>
</data>
<data name="label42.Text" xml:space="preserve">
<value>Серийный номер 42</value>
</data>
<data name="label41.Text" xml:space="preserve">
<value>Серийный номер 41</value>
</data>
<data name="label40.Text" xml:space="preserve">
<value>Серийный номер 40</value>
</data>
<data name="label39.Text" xml:space="preserve">
<value>Серийный номер 39</value>
</data>
<data name="label38.Text" xml:space="preserve">
<value>Серийный номер 38</value>
</data>
<data name="label37.Text" xml:space="preserve">
<value>Серийный номер 37</value>
</data>
<data name="label36.Text" xml:space="preserve">
<value>Серийный номер 36</value>
</data>
<data name="label35.Text" xml:space="preserve">
<value>Серийный номер 35</value>
</data>
<data name="label34.Text" xml:space="preserve">
<value>Серийный номер 34</value>
</data>
<data name="label33.Text" xml:space="preserve">
<value>Серийный номер 33</value>
</data>
<data name="label32.Text" xml:space="preserve">
<value>Серийный номер 32</value>
</data>
<data name="label31.Text" xml:space="preserve">
<value>Серийный номер 31</value>
</data>
<data name="label30.Text" xml:space="preserve">
<value>Серийный номер 30</value>
</data>
<data name="label29.Text" xml:space="preserve">
<value>Серийный номер 29</value>
</data>
<data name="label28.Text" xml:space="preserve">
<value>Серийный номер 28</value>
</data>
<data name="label27.Text" xml:space="preserve">
<value>Серийный номер 27</value>
</data>
<data name="label26.Text" xml:space="preserve">
<value>Серийный номер 26</value>
</data>
<data name="label25.Text" xml:space="preserve">
<value>Серийный номер 25</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>Пакетные данные</value>
</data>
</root>

View File

@ -0,0 +1,165 @@
///
/// Copyright (c) 2017 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
using log4net;
using TBF.Resources;
namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
{
public partial class CycleEndForm : Form, GenericDevices.IHasCompleted
{
private static readonly ILog log = LogManager.GetLogger(typeof(CycleEndForm));
/// <summary> Number of text boxes for serial numbers </summary>
public readonly int WaterMetersCount;
readonly int lineSize;
// To be retrieved after the form closes
public string[] EndStateText;
// Set to 'true' when the form closes
public bool Completed { get { return completed; } }
bool completed;
int textBoxesCount;
Label[] labels;
TextBox[] textBoxes;
/// <summary>
/// Constructor
/// </summary>
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
public CycleEndForm()
{
InitializeComponent();
ControlBox = false;
labels = new Label[]
{
label1, label2, label3, label4, label5, label6, label7, label8, label9, label10,
label11, label12, label13, label14, label15, label16, label17, label18, label19, label20,
label21, label22, label23, label24,
};
textBoxes = new TextBox[]
{
textBox1, textBox2, textBox3, textBox4, textBox5, textBox6,
textBox7, textBox8, textBox9, textBox10, textBox11, textBox12,
textBox13, textBox14, textBox15, textBox16, textBox17, textBox18,
textBox19, textBox20, textBox21, textBox22, textBox23, textBox24,
};
textBoxesCount = textBoxes.Length;
this.WaterMetersCount = textBoxesCount;
this.lineSize = textBoxesCount / 2;
completed = false;
StartForceCloseHandler();
}
/// <summary> Parameterless constructor for 3 watermeters </summary>
public CycleEndForm(int waterMetersCount, int lineSize)
: this()
{
this.WaterMetersCount = waterMetersCount;
this.lineSize = lineSize;
ShuffleTextBoxes(waterMetersCount, lineSize);
EndStateText = new string[WaterMetersCount];
}
/// <summary>
/// Make sure the layout of labels/text boxes on the screen
/// corresponds to the layout of watermeters of the test bench.
/// </summary>
/// <param name="wmsCount">Number of watermeters</param>
/// <param name="lineSize">Number of watermeters in one line</param>
void ShuffleTextBoxes(int wmsCount, int lineSize)
{
for (int i = 0; i < textBoxesCount; i++)
{
labels[i].Visible = false;
textBoxes[i].Visible = false;
}
if (wmsCount < textBoxesCount && lineSize > 0)
{
int nrLines;
int realLineSize;
if (WaterMetersCount <= 6)
{
realLineSize = WaterMetersCount;
nrLines = 1;
}
else
{
nrLines = (wmsCount + lineSize - 1) / lineSize;
realLineSize = lineSize;
}
int gap = (textBoxesCount - wmsCount) / nrLines;
int dest = 0;
for (int l = 0; l < nrLines; l++)
{
for (int i = 0; i < realLineSize; i++)
{
labels[dest] = labels[l * lineSize + l * gap + i];
textBoxes[dest] = textBoxes[l * lineSize + l * gap + i];
labels[dest].Visible = true;
textBoxes[dest].Visible = true;
dest++;
}
}
textBoxesCount = wmsCount;
Height = 60 + 36 * realLineSize;
}
}
private void CycleEndForm_Load(object sender, EventArgs e)
{
Localize();
}
void Localize()
{
Text = Strings.Data;
okButton.Text = Strings.OkBtnText;
for (int i = 0; i < WaterMetersCount; i++)
{
labels[i].Text = string.Format("{0} {1}:", Strings.Water_Meter, (i + 1).ToString());
}
}
private void okButton_Click(object sender, EventArgs e)
{
for (int i = 0; i < WaterMetersCount; i++)
{
EndStateText[i] = textBoxes[i].Text;
}
completed = true;
Close();
}
#region Forced close handling
public void StartForceCloseHandler()
{
UiBridge.Bridge.CloseModelessFormHandler += delegate(object sender, EventArgs args)
{
if (InvokeRequired) { Invoke(new EventHandler<EventArgs>(OnForceClose), sender, args); }
else OnForceClose(sender, args);
};
}
void OnForceClose(object sender, EventArgs args)
{
DialogResult = DialogResult.Cancel;
Close();
}
#endregion
}
}

View File

@ -0,0 +1,652 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
///
namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
{
partial class CycleEndForm
{
/// <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.textBox2 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.okButton = new System.Windows.Forms.Button();
this.textBox3 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.textBox4 = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.textBox5 = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.textBox6 = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.textBox7 = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.textBox8 = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.textBox9 = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label();
this.textBox10 = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.textBox11 = new System.Windows.Forms.TextBox();
this.label11 = new System.Windows.Forms.Label();
this.textBox12 = new System.Windows.Forms.TextBox();
this.label12 = new System.Windows.Forms.Label();
this.textBox13 = new System.Windows.Forms.TextBox();
this.label13 = new System.Windows.Forms.Label();
this.textBox14 = new System.Windows.Forms.TextBox();
this.label14 = new System.Windows.Forms.Label();
this.textBox15 = new System.Windows.Forms.TextBox();
this.label15 = new System.Windows.Forms.Label();
this.textBox16 = new System.Windows.Forms.TextBox();
this.label16 = new System.Windows.Forms.Label();
this.textBox17 = new System.Windows.Forms.TextBox();
this.label17 = new System.Windows.Forms.Label();
this.textBox18 = new System.Windows.Forms.TextBox();
this.label18 = new System.Windows.Forms.Label();
this.textBox19 = new System.Windows.Forms.TextBox();
this.label19 = new System.Windows.Forms.Label();
this.textBox20 = new System.Windows.Forms.TextBox();
this.label20 = new System.Windows.Forms.Label();
this.textBox21 = new System.Windows.Forms.TextBox();
this.label21 = new System.Windows.Forms.Label();
this.textBox22 = new System.Windows.Forms.TextBox();
this.label22 = new System.Windows.Forms.Label();
this.textBox23 = new System.Windows.Forms.TextBox();
this.label23 = new System.Windows.Forms.Label();
this.textBox24 = new System.Windows.Forms.TextBox();
this.label24 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(205, 66);
this.textBox2.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(169, 27);
this.textBox2.TabIndex = 1;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(38, 71);
this.label2.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(62, 18);
this.label2.TabIndex = 0;
this.label2.Text = "Stand:";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(205, 30);
this.textBox1.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(169, 27);
this.textBox1.TabIndex = 1;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(38, 35);
this.label1.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(62, 18);
this.label1.TabIndex = 0;
this.label1.Text = "Stand:";
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.okButton.ForeColor = System.Drawing.Color.Black;
this.okButton.Location = new System.Drawing.Point(832, 30);
this.okButton.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(90, 60);
this.okButton.TabIndex = 7;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(205, 102);
this.textBox3.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(169, 27);
this.textBox3.TabIndex = 1;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(38, 107);
this.label3.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(62, 18);
this.label3.TabIndex = 0;
this.label3.Text = "Stand:";
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(205, 138);
this.textBox4.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(169, 27);
this.textBox4.TabIndex = 1;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(38, 143);
this.label4.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(62, 18);
this.label4.TabIndex = 0;
this.label4.Text = "Stand:";
//
// textBox5
//
this.textBox5.Location = new System.Drawing.Point(205, 174);
this.textBox5.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(169, 27);
this.textBox5.TabIndex = 1;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(38, 179);
this.label5.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(62, 18);
this.label5.TabIndex = 0;
this.label5.Text = "Stand:";
//
// textBox6
//
this.textBox6.Location = new System.Drawing.Point(205, 210);
this.textBox6.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox6.Name = "textBox6";
this.textBox6.Size = new System.Drawing.Size(169, 27);
this.textBox6.TabIndex = 1;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(38, 215);
this.label6.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(62, 18);
this.label6.TabIndex = 0;
this.label6.Text = "Stand:";
//
// textBox7
//
this.textBox7.Location = new System.Drawing.Point(205, 246);
this.textBox7.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox7.Name = "textBox7";
this.textBox7.Size = new System.Drawing.Size(169, 27);
this.textBox7.TabIndex = 9;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(38, 251);
this.label7.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(62, 18);
this.label7.TabIndex = 8;
this.label7.Text = "Stand:";
//
// textBox8
//
this.textBox8.Location = new System.Drawing.Point(205, 282);
this.textBox8.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox8.Name = "textBox8";
this.textBox8.Size = new System.Drawing.Size(169, 27);
this.textBox8.TabIndex = 11;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(38, 287);
this.label8.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(62, 18);
this.label8.TabIndex = 10;
this.label8.Text = "Stand:";
//
// textBox9
//
this.textBox9.Location = new System.Drawing.Point(205, 318);
this.textBox9.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox9.Name = "textBox9";
this.textBox9.Size = new System.Drawing.Size(169, 27);
this.textBox9.TabIndex = 13;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(38, 323);
this.label9.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(62, 18);
this.label9.TabIndex = 12;
this.label9.Text = "Stand:";
//
// textBox10
//
this.textBox10.Location = new System.Drawing.Point(205, 354);
this.textBox10.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox10.Name = "textBox10";
this.textBox10.Size = new System.Drawing.Size(169, 27);
this.textBox10.TabIndex = 15;
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(38, 359);
this.label10.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(62, 18);
this.label10.TabIndex = 14;
this.label10.Text = "Stand:";
//
// textBox11
//
this.textBox11.Location = new System.Drawing.Point(205, 390);
this.textBox11.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox11.Name = "textBox11";
this.textBox11.Size = new System.Drawing.Size(169, 27);
this.textBox11.TabIndex = 17;
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(38, 395);
this.label11.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(62, 18);
this.label11.TabIndex = 16;
this.label11.Text = "Stand:";
//
// textBox12
//
this.textBox12.Location = new System.Drawing.Point(205, 426);
this.textBox12.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox12.Name = "textBox12";
this.textBox12.Size = new System.Drawing.Size(169, 27);
this.textBox12.TabIndex = 19;
//
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(38, 431);
this.label12.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(62, 18);
this.label12.TabIndex = 18;
this.label12.Text = "Stand:";
//
// textBox13
//
this.textBox13.Location = new System.Drawing.Point(623, 30);
this.textBox13.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox13.Name = "textBox13";
this.textBox13.Size = new System.Drawing.Size(169, 27);
this.textBox13.TabIndex = 21;
//
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(456, 35);
this.label13.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(62, 18);
this.label13.TabIndex = 20;
this.label13.Text = "Stand:";
//
// textBox14
//
this.textBox14.Location = new System.Drawing.Point(623, 66);
this.textBox14.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox14.Name = "textBox14";
this.textBox14.Size = new System.Drawing.Size(169, 27);
this.textBox14.TabIndex = 23;
//
// label14
//
this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(456, 71);
this.label14.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(62, 18);
this.label14.TabIndex = 22;
this.label14.Text = "Stand:";
//
// textBox15
//
this.textBox15.Location = new System.Drawing.Point(623, 102);
this.textBox15.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox15.Name = "textBox15";
this.textBox15.Size = new System.Drawing.Size(169, 27);
this.textBox15.TabIndex = 25;
//
// label15
//
this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(456, 107);
this.label15.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(62, 18);
this.label15.TabIndex = 24;
this.label15.Text = "Stand:";
//
// textBox16
//
this.textBox16.Location = new System.Drawing.Point(623, 138);
this.textBox16.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox16.Name = "textBox16";
this.textBox16.Size = new System.Drawing.Size(169, 27);
this.textBox16.TabIndex = 27;
//
// label16
//
this.label16.AutoSize = true;
this.label16.Location = new System.Drawing.Point(456, 143);
this.label16.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(62, 18);
this.label16.TabIndex = 26;
this.label16.Text = "Stand:";
//
// textBox17
//
this.textBox17.Location = new System.Drawing.Point(623, 174);
this.textBox17.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox17.Name = "textBox17";
this.textBox17.Size = new System.Drawing.Size(169, 27);
this.textBox17.TabIndex = 29;
//
// label17
//
this.label17.AutoSize = true;
this.label17.Location = new System.Drawing.Point(456, 179);
this.label17.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(62, 18);
this.label17.TabIndex = 28;
this.label17.Text = "Stand:";
//
// textBox18
//
this.textBox18.Location = new System.Drawing.Point(623, 210);
this.textBox18.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox18.Name = "textBox18";
this.textBox18.Size = new System.Drawing.Size(169, 27);
this.textBox18.TabIndex = 31;
//
// label18
//
this.label18.AutoSize = true;
this.label18.Location = new System.Drawing.Point(456, 215);
this.label18.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(62, 18);
this.label18.TabIndex = 30;
this.label18.Text = "Stand:";
//
// textBox19
//
this.textBox19.Location = new System.Drawing.Point(623, 246);
this.textBox19.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox19.Name = "textBox19";
this.textBox19.Size = new System.Drawing.Size(169, 27);
this.textBox19.TabIndex = 33;
//
// label19
//
this.label19.AutoSize = true;
this.label19.Location = new System.Drawing.Point(456, 251);
this.label19.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(62, 18);
this.label19.TabIndex = 32;
this.label19.Text = "Stand:";
//
// textBox20
//
this.textBox20.Location = new System.Drawing.Point(623, 282);
this.textBox20.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox20.Name = "textBox20";
this.textBox20.Size = new System.Drawing.Size(169, 27);
this.textBox20.TabIndex = 35;
//
// label20
//
this.label20.AutoSize = true;
this.label20.Location = new System.Drawing.Point(456, 287);
this.label20.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label20.Name = "label20";
this.label20.Size = new System.Drawing.Size(62, 18);
this.label20.TabIndex = 34;
this.label20.Text = "Stand:";
//
// textBox21
//
this.textBox21.Location = new System.Drawing.Point(623, 318);
this.textBox21.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox21.Name = "textBox21";
this.textBox21.Size = new System.Drawing.Size(169, 27);
this.textBox21.TabIndex = 37;
//
// label21
//
this.label21.AutoSize = true;
this.label21.Location = new System.Drawing.Point(456, 323);
this.label21.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label21.Name = "label21";
this.label21.Size = new System.Drawing.Size(62, 18);
this.label21.TabIndex = 36;
this.label21.Text = "Stand:";
//
// textBox22
//
this.textBox22.Location = new System.Drawing.Point(623, 354);
this.textBox22.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox22.Name = "textBox22";
this.textBox22.Size = new System.Drawing.Size(169, 27);
this.textBox22.TabIndex = 39;
//
// label22
//
this.label22.AutoSize = true;
this.label22.Location = new System.Drawing.Point(456, 359);
this.label22.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label22.Name = "label22";
this.label22.Size = new System.Drawing.Size(62, 18);
this.label22.TabIndex = 38;
this.label22.Text = "Stand:";
//
// textBox23
//
this.textBox23.Location = new System.Drawing.Point(623, 390);
this.textBox23.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox23.Name = "textBox23";
this.textBox23.Size = new System.Drawing.Size(169, 27);
this.textBox23.TabIndex = 41;
//
// label23
//
this.label23.AutoSize = true;
this.label23.Location = new System.Drawing.Point(456, 395);
this.label23.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label23.Name = "label23";
this.label23.Size = new System.Drawing.Size(62, 18);
this.label23.TabIndex = 40;
this.label23.Text = "Stand:";
//
// textBox24
//
this.textBox24.Location = new System.Drawing.Point(623, 426);
this.textBox24.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.textBox24.Name = "textBox24";
this.textBox24.Size = new System.Drawing.Size(169, 27);
this.textBox24.TabIndex = 43;
//
// label24
//
this.label24.AutoSize = true;
this.label24.Location = new System.Drawing.Point(456, 431);
this.label24.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.label24.Name = "label24";
this.label24.Size = new System.Drawing.Size(62, 18);
this.label24.TabIndex = 42;
this.label24.Text = "Stand:";
//
// CycleEndForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.DarkGray;
this.ClientSize = new System.Drawing.Size(959, 489);
this.Controls.Add(this.textBox24);
this.Controls.Add(this.label24);
this.Controls.Add(this.textBox23);
this.Controls.Add(this.label23);
this.Controls.Add(this.textBox22);
this.Controls.Add(this.label22);
this.Controls.Add(this.textBox21);
this.Controls.Add(this.label21);
this.Controls.Add(this.textBox20);
this.Controls.Add(this.label20);
this.Controls.Add(this.textBox19);
this.Controls.Add(this.label19);
this.Controls.Add(this.textBox18);
this.Controls.Add(this.label18);
this.Controls.Add(this.textBox17);
this.Controls.Add(this.label17);
this.Controls.Add(this.textBox16);
this.Controls.Add(this.label16);
this.Controls.Add(this.textBox15);
this.Controls.Add(this.label15);
this.Controls.Add(this.textBox14);
this.Controls.Add(this.label14);
this.Controls.Add(this.textBox13);
this.Controls.Add(this.label13);
this.Controls.Add(this.textBox12);
this.Controls.Add(this.label12);
this.Controls.Add(this.textBox11);
this.Controls.Add(this.label11);
this.Controls.Add(this.textBox10);
this.Controls.Add(this.label10);
this.Controls.Add(this.textBox9);
this.Controls.Add(this.label9);
this.Controls.Add(this.textBox8);
this.Controls.Add(this.label8);
this.Controls.Add(this.textBox7);
this.Controls.Add(this.label7);
this.Controls.Add(this.textBox6);
this.Controls.Add(this.label6);
this.Controls.Add(this.textBox5);
this.Controls.Add(this.label5);
this.Controls.Add(this.textBox4);
this.Controls.Add(this.label4);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.label3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
this.Controls.Add(this.okButton);
this.Font = new System.Drawing.Font("Verdana", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.Name = "CycleEndForm";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.Text = "Daten";
this.TopMost = true;
this.Load += new System.EventHandler(this.CycleEndForm_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox textBox5;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox textBox6;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox textBox7;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox textBox8;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.TextBox textBox9;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox textBox10;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.TextBox textBox11;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.TextBox textBox12;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.TextBox textBox13;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.TextBox textBox14;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.TextBox textBox15;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.TextBox textBox16;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.TextBox textBox17;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.TextBox textBox18;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.TextBox textBox19;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.TextBox textBox20;
private System.Windows.Forms.Label label20;
private System.Windows.Forms.TextBox textBox21;
private System.Windows.Forms.Label label21;
private System.Windows.Forms.TextBox textBox22;
private System.Windows.Forms.Label label22;
private System.Windows.Forms.TextBox textBox23;
private System.Windows.Forms.Label label23;
private System.Windows.Forms.TextBox textBox24;
private System.Windows.Forms.Label label24;
}
}

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,445 @@
///
/// Copyright (c) 2017-2022 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using log4net;
using Common;
using TBF.Rig.GenericDevices;
namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
{
public class EntryForm : ComponentBase, IOperation, IDataEntryForCamera, IHasWMStatesForm, IHasCycleBeginForm, IHasCycleEndForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm));
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
const string DfltOcrWorkspaceFolder = "C:\\TBF\\OCR\\";
const string DfltOcrWorkspaceExt = ".vrws";
static Dictionary<string, OcrVidi> ocrDictionary = new Dictionary<string, OcrVidi>();
readonly EntryFormCfg entryFormCfg;
public string OcrWorkspace
{
get { return (entryFormCfg != null && entryFormCfg.ProcParams != null) ? entryFormCfg.ProcParams.OcrWorkspace : string.Empty; }
}
public string OcrStream
{
get { return (entryFormCfg != null && entryFormCfg.ProcParams != null) ? entryFormCfg.ProcParams.OcrStream : string.Empty; }
}
IRegReader[] regReaders;
public string[] StartImages
{
get { return startImages; }
set
{
/*if (entryFormCfg.DebugLevel == DebugMode.Simulate )
{
startImages = new string[] { "C:\\TBF\\Images\\Test\\Image1.jpg", "C:\\TBF\\Images\\Test\\Image2.jpg",
"C:\\TBF\\Images\\Test\\Image3.jpg", "C:\\TBF\\Images\\Test\\Image4.jpg", "C:\\TBF\\Images\\Test\\Image5.jpg",
"C:\\TBF\\Images\\Test\\Image1.jpg", "C:\\TBF\\Images\\Test\\Image2.jpg", "C:\\TBF\\Images\\Test\\Image3.jpg",
"C:\\TBF\\Images\\Test\\Image4.jpg", "C:\\TBF\\Images\\Test\\Image5.jpg", "C:\\TBF\\Images\\Test\\Image1.jpg",
"C:\\TBF\\Images\\Test\\Image2.jpg", "C:\\TBF\\Images\\Test\\Image3.jpg", "C:\\TBF\\Images\\Test\\Image4.jpg",
"C:\\TBF\\Images\\Test\\Image5.jpg", "C:\\TBF\\Images\\Test\\Image1.jpg", "C:\\TBF\\Images\\Test\\Image2.jpg",
"C:\\TBF\\Images\\Test\\Image3.jpg", "C:\\TBF\\Images\\Test\\Image4.jpg", "C:\\TBF\\Images\\Test\\Image5.jpg" };
}
else*/
{
startImages = value;
}
}
}
string[] startImages;
public string[] EndImages
{
get { return endImages; }
set { endImages = value; }
}
string[] endImages;
public bool SaveImages
{
get { return entryFormCfg.SaveImages; }
}
/// <summary>
/// Properties set by the Begin, End and WMStates form
/// </summary>
bool[] disabled; /// This array is shared between forms
string[] wmCycleEndState;
public string WMCycleEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmCycleEndState.Length) ? wmCycleEndState[wmNr] : string.Empty; }
double[] wmStartState;
public double WMStartState(int wmNr)
{
bool real = (wmNr >= 0 && wmNr < wmStartState.Length);
log.DebugFormat("WMEndState, wmNr:{0}, wmEndState real: {1}, wmEndState[wmNr]: {2} ",wmNr,real, real ? wmStartState[wmNr] : 0);
return real ? wmStartState[wmNr] : 0;
}
double[] wmEndState;
public double WMEndState(int wmNr)
{
bool real = (wmNr >= 0 && wmNr < wmEndState.Length);
log.DebugFormat("WMEndState, wmNr:{0}, wmEndState real: {1}, wmEndState[wmNr]: {2} ",wmNr,real, real ? wmEndState[wmNr] : 0);
return real ? wmEndState[wmNr] : 0;
}
string[] wmStartStateStr;
System.Windows.Forms.Form modelessDlg;
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
double refVolume;
double errLimLo;
double errLimHi;
bool resultSaved; /// Set in Run() when results are saved
IList<Results.Entities.WaterMeter> waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
public string TestStartImgName(int wmNr0, string testName)
{
if (waterMeters == null || wmNr0 < 0 || wmNr0 >= waterMeters.Count) return string.Empty;
return string.Format("{0}-start.bmp", testName).Replace(' ','_');
}
public string TestEndImgName(int wmNr0, string testName)
{
if (waterMeters == null || wmNr0 < 0 || wmNr0 >= waterMeters.Count) return string.Empty;
return string.Format("{0}-end.bmp", testName).Replace(' ','_');
}
public enum CurrentOp
{
None,
ShowFormAtCycleBeginning,
ShowFormAtCycleEnd,
TestStartStates,
TestEndStates,
DeferredTestEval,
}
CurrentOp currentOp;
public EntryForm() { }
public EntryForm(Generic.IComponentCfg cfg)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
}
public override void Initialize()
{
disabled = new bool[TBF.Data.WMsCount];
wmStartState = new double[TBF.Data.WMsCount];
wmStartStateStr = new string[TBF.Data.WMsCount];
wmEndState = new double[TBF.Data.WMsCount];
wmCycleEndState = new string[TBF.Data.WMsCount];
currentOp = CurrentOp.None;
log.FatalFormat("{0} initialized: {1}", Name, this);
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleBeginFormOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleBeginning;
this.waterMeters = TBF.Rig.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowCycleEndFormOp(IList<Results.Entities.WaterMeter> waterMeters)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleEnd;
this.waterMeters = waterMeters;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.TestStartStates;
this.regReaders = regReaders;
return this;
}
/// <returns>null (not implemented)</returns>
public IOperation ShowAdvancedTestStartFormOp(IRegReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
/// <returns>Reference to the operation</returns>
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.TestEndStates;
this.regReaders = regReaders;
this.refVolume = refVolume;
this.errLimLo = errLimLo;
this.errLimHi = errLimHi;
return this;
}
/// <returns>Reference to the operation</returns>
public IOperation ShowDeferredTestEvalFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.DeferredTestEval;
this.regReaders = regReaders;
this.refVolume = refVolume;
this.errLimLo = errLimLo;
this.errLimHi = errLimHi;
return this;
}
delegate void EntryFormDlgt(EntryForm myRef);
///
void OpenBeginningDlg(EntryForm myRef)
{
myRef.modelessDlg = new CycleBeginningForm(TBF.Data.WMsCount, entryFormCfg.HideOrder);
modelessDlg.Show();
}
///
void OpenEndDlg(EntryForm myRef)
{
myRef.modelessDlg = new CycleEndForm(TBF.Data.WMsCount, TBF.Data.LineSize);
modelessDlg.Show();
}
///
void OpenTestStartStatesDlg(EntryForm myRef)
{
log.Debug("-- OpenTestStartStatesDlg --");
string ocrMessage;
var ocr = GetOcr(myRef.OcrWorkspace, out ocrMessage);
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, ocr, ocrMessage, myRef.OcrStream,
startImages, disabled);
modelessDlg.Show();
}
///
void OpenTestEndStatesDlg(EntryForm myRef)
{
log.Debug("-- OpenTestEndStatesDlg --");
string ocrMessage;
var ocr = GetOcr(myRef.OcrWorkspace, out ocrMessage);
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, ocr, ocrMessage, myRef.OcrStream,
startImages, wmStartState, wmStartStateStr, endImages, disabled,
refVolume, errLimLo, errLimHi);
modelessDlg.Show();
}
///
void OpenDeferredTestEvalDlg(EntryForm myRef)
{
string ocrMessage;
var ocr = GetOcr(myRef.OcrWorkspace, out ocrMessage);
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, ocr, ocrMessage, myRef.OcrStream,
startImages, endImages, disabled,
refVolume, errLimLo, errLimHi);
modelessDlg.Show();
}
///
OcrVidi GetOcr(string ocrWorkspace, out string message)
{
message = string.Empty;
if (string.IsNullOrEmpty(ocrWorkspace)) return null; /// No OCR was configured
string fullPath = (ocrWorkspace.Contains("\\") || ocrWorkspace.Contains("/"))
? ocrWorkspace.Replace('/', '\\')
: System.IO.Path.Combine(DfltOcrWorkspaceFolder, ocrWorkspace);
if (!fullPath.Contains(".")) fullPath = fullPath + DfltOcrWorkspaceExt;
OcrVidi ocrVidi;
if (ocrDictionary.TryGetValue(fullPath, out ocrVidi))
{
log.InfoFormat("existing OcrVidi({0}) was retrieved from dictionary", fullPath);
return ocrVidi;
}
try
{
ocrVidi = new OcrVidi(fullPath);
ocrDictionary.Add(fullPath, ocrVidi);
log.WarnFormat("new OcrVidi({0}) was added to dictionary", fullPath);
return ocrVidi;
}
catch (Exception e)
{
if (e.InnerException != null)
{
log.ErrorFormat("new OcrVidi({0}) thrown {1}: {2} / {3}",
fullPath, e.GetType().ToString(), e.Message,e.InnerException.Message);
}
else
{
log.ErrorFormat("new OcrVidi({0}) thrown {1}: {2}",
fullPath, e.GetType().ToString(), e.Message);
}
log.ErrorFormat("Stack trace:\r\n{0}", e.StackTrace);
message = string.Format("Cannot load OCR workspace:\r\n{0}\r\nOCR workspace file is {1}", e.Message, fullPath);
return null;
}
}
/// <summary>Start this operation</summary>
public void Start()
{
resultSaved = false;
switch (currentOp)
{
case CurrentOp.ShowFormAtCycleBeginning:
if (!entryFormCfg.EnterSerialNrsAtTheEnd)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
}
break;
case CurrentOp.ShowFormAtCycleEnd:
if (entryFormCfg.EnterSerialNrsAtTheEnd)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
}
else if (entryFormCfg.ShowCycleEndForm)
{
Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this);
}
break;
case CurrentOp.TestStartStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestStartStatesDlg), this);
break;
case CurrentOp.TestEndStates:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestEndStatesDlg), this);
break;
case CurrentOp.DeferredTestEval:
Program.MainWnd.Invoke(new EntryFormDlgt(OpenDeferredTestEvalDlg), this);
break;
}
}
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
if ((modelessDlg is IHasCompleted) && !(modelessDlg as IHasCompleted).Completed)
{
return Event.ModelessFormIsOpen;
}
if (!resultSaved) /// This is to save the result only once
{
if ((!entryFormCfg.EnterSerialNrsAtTheEnd && currentOp == CurrentOp.ShowFormAtCycleBeginning) ||
(entryFormCfg.EnterSerialNrsAtTheEnd && currentOp == CurrentOp.ShowFormAtCycleEnd))
{
CycleBeginningForm dlg = (modelessDlg as CycleBeginningForm);
if (dlg != null)
{
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Count); i++)
{
if (waterMeters[i] != null)
{
waterMeters[i].Disabled = disabled[i] = dlg.Disabled[i];
waterMeters[i].SerialNr = dlg.SNText[i];
if (!entryFormCfg.HideOrder && dlg.PurchaseOrder != null) waterMeters[i].PurchaseOrder = dlg.PurchaseOrder;
}
}
}
}
else if (currentOp == CurrentOp.ShowFormAtCycleEnd)
{
if (modelessDlg is CycleEndForm)
{
CycleEndForm dlg = (modelessDlg as CycleEndForm);
int count = waterMeters.Count;
if ((dlg != null) && (count > dlg.WaterMetersCount)) count = dlg.WaterMetersCount;
for (int i = 0; i < count; i++)
{
if (waterMeters[i] != null)
{
/// In case entryFormCfg.ShowCycleEndForm == false dlg would be null, values would be string.Empty
wmCycleEndState[i] = waterMeters[i].EndState = (dlg != null) ? dlg.EndStateText[i] : string.Empty;
}
}
}
}
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.TestStartStates)
{
/// Fixed start/stop: test start
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
wmStartState[i] = dlg.WMStartState[i];
wmStartStateStr[i] = dlg.WMStartStateStr[i];
}
}
}
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.TestEndStates)
{
/// Fixed start/stop: test end
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
wmStartState[i] = dlg.WMStartState[i];
wmStartStateStr[i] = dlg.WMStartStateStr[i];
wmEndState[i] = dlg.WMEndState[i];
}
}
}
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.DeferredTestEval)
{
/// Fixed start/stop: deferred test evaluation
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
if (dlg != null)
{
for (int i = 0; i < dlg.WaterMetersCount; i++)
{
wmStartState[i] = dlg.WMStartState[i];
wmStartStateStr[i] = dlg.WMStartStateStr[i];
wmEndState[i] = dlg.WMEndState[i];
}
}
}
resultSaved = true;
modelessDlg = null;
}
return Event.ModelessFormClosed; /// Form closed
}
/// <summary>Stop this operation</summary>
public void Stop()
{
if (modelessDlg is IHasCompleted)
{
UiBridge.Bridge.OnCloseModelessForm(this, null);
modelessDlg = null;
}
currentOp = CurrentOp.None;
}
}
}

View File

@ -0,0 +1,58 @@
///
/// Copyright (c) 2017-2022 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using Common;
using TBF.Rig.Generic;
namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
{
public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(EntryFormCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new EntryFormCfgCtrl(); }
///
/// Serialized parameters
///
public bool HideOrder;
public bool EnterSerialNrsAtTheEnd;
public bool ShowCycleEndForm;
public bool SaveImages;
/// <summary> Procedure parameters </summary>
[XmlIgnore]
public ProcParams ProcParams;
public override IParamsProvider GetRuntimeProcParamsProvider() { return ProcParams; }
public override IParamsProvider CreateProcParamsProvider() { return new ProcParams(true); }
/// Private parameterless constructor invoked by all other (public) constructors
EntryFormCfg()
{
ProcParams = new ProcParams(true);
Name = "DataEntry-for-Camera-PO";
ParentName = string.Empty;
HideOrder = false;
EnterSerialNrsAtTheEnd = false;
ShowCycleEndForm = false;
SaveImages = false;
}
public EntryFormCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
}
public string ToString(int i)
{
return string.Format("Name={0}, HideOrder={1} SNsAtTheEnd={2}, EndForm={3}, SaveImages={4}", Name, HideOrder, EnterSerialNrsAtTheEnd, ShowCycleEndForm, SaveImages);
}
}
}

View File

@ -0,0 +1,91 @@
///
/// Copyright (c) 2017-2021 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
using Common;
using Config.Entities;
using TBF.Rig.Generic;
using TBF.Resources;
namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
{
public partial class EntryFormCfgCtrl : UserControl, IComponentCfgCtrl
{
public bool ShowMore { get { return false; } }
EntryFormCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
set
{
config = value as EntryFormCfg;
Redraw();
}
}
public EntryFormCfgCtrl()
{
InitializeComponent();
}
private void EntryFormCfgCtrl_Load(object sender, EventArgs e)
{
Localize();
Redraw();
}
void Localize()
{
enterSNsAtTheEndCheckBox.Text = Strings.Enter_SNs_at_the_end;
showEndStateFormCheckBox.Text = Strings.Show_cycle_end_form;
saveImagesCheckBox.Text = "Save images";
}
public void Closing()
{
}
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
hideOrderCheckBox.Checked = config.HideOrder;
enterSNsAtTheEndCheckBox.Checked = config.EnterSerialNrsAtTheEnd;
showEndStateFormCheckBox.Checked = config.ShowCycleEndForm;
saveImagesCheckBox.Checked = config.SaveImages;
}
public void Unlock()
{
nameTextBox.Enabled = true;
hideOrderCheckBox.Enabled = true;
enterSNsAtTheEndCheckBox.Enabled = true;
showEndStateFormCheckBox.Enabled = true;
saveImagesCheckBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
config.Name = nameTextBox.Text;
config.HideOrder = hideOrderCheckBox.Checked;
config.EnterSerialNrsAtTheEnd = enterSNsAtTheEndCheckBox.Checked;
config.ShowCycleEndForm = showEndStateFormCheckBox.Checked;
config.SaveImages = saveImagesCheckBox.Checked;
return flags;
}
}
}

View File

@ -0,0 +1,142 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
{
partial class EntryFormCfgCtrl
{
/// <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 Component 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.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.showEndStateFormCheckBox = new System.Windows.Forms.CheckBox();
this.enterSNsAtTheEndCheckBox = new System.Windows.Forms.CheckBox();
this.saveImagesCheckBox = new System.Windows.Forms.CheckBox();
this.hideOrderCheckBox = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(136, 31);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
this.nameTextBox.TabIndex = 2;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(26, 34);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(133, 10);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(61, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "Class name";
//
// showEndStateFormCheckBox
//
this.showEndStateFormCheckBox.AutoSize = true;
this.showEndStateFormCheckBox.Enabled = false;
this.showEndStateFormCheckBox.Location = new System.Drawing.Point(136, 103);
this.showEndStateFormCheckBox.Name = "showEndStateFormCheckBox";
this.showEndStateFormCheckBox.Size = new System.Drawing.Size(151, 17);
this.showEndStateFormCheckBox.TabIndex = 5;
this.showEndStateFormCheckBox.Text = "Watermeter end state form";
this.showEndStateFormCheckBox.UseVisualStyleBackColor = true;
//
// enterSNsAtTheEndCheckBox
//
this.enterSNsAtTheEndCheckBox.AutoSize = true;
this.enterSNsAtTheEndCheckBox.Enabled = false;
this.enterSNsAtTheEndCheckBox.Location = new System.Drawing.Point(136, 82);
this.enterSNsAtTheEndCheckBox.Name = "enterSNsAtTheEndCheckBox";
this.enterSNsAtTheEndCheckBox.Size = new System.Drawing.Size(167, 17);
this.enterSNsAtTheEndCheckBox.TabIndex = 4;
this.enterSNsAtTheEndCheckBox.Text = "Enter serial number at the end";
this.enterSNsAtTheEndCheckBox.UseVisualStyleBackColor = true;
//
// saveImagesCheckBox
//
this.saveImagesCheckBox.AutoSize = true;
this.saveImagesCheckBox.Enabled = false;
this.saveImagesCheckBox.Location = new System.Drawing.Point(136, 124);
this.saveImagesCheckBox.Name = "saveImagesCheckBox";
this.saveImagesCheckBox.Size = new System.Drawing.Size(87, 17);
this.saveImagesCheckBox.TabIndex = 6;
this.saveImagesCheckBox.Text = "Save images";
this.saveImagesCheckBox.UseVisualStyleBackColor = true;
//
// hideOrderCheckBox
//
this.hideOrderCheckBox.AutoSize = true;
this.hideOrderCheckBox.Enabled = false;
this.hideOrderCheckBox.Location = new System.Drawing.Point(136, 61);
this.hideOrderCheckBox.Name = "hideOrderCheckBox";
this.hideOrderCheckBox.Size = new System.Drawing.Size(103, 17);
this.hideOrderCheckBox.TabIndex = 3;
this.hideOrderCheckBox.Text = "Hide \'Order\' field";
this.hideOrderCheckBox.UseVisualStyleBackColor = true;
//
// EntryFormCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.hideOrderCheckBox);
this.Controls.Add(this.saveImagesCheckBox);
this.Controls.Add(this.enterSNsAtTheEndCheckBox);
this.Controls.Add(this.showEndStateFormCheckBox);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "EntryFormCfgCtrl";
this.Size = new System.Drawing.Size(359, 275);
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.CheckBox showEndStateFormCheckBox;
private System.Windows.Forms.CheckBox enterSNsAtTheEndCheckBox;
private System.Windows.Forms.CheckBox saveImagesCheckBox;
private System.Windows.Forms.CheckBox hideOrderCheckBox;
}
}

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,25 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System.Collections.Generic;
using TBF.Rig.Generic;
namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
{
public class Factory : IComponentFactory
{
public string ClassName { get { return "DataEntry-CameraPurchaseOrder"; } }
public override string ToString() { return ClassName; }
public IComponent DummyComponent() { return new EntryForm(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new EntryForm(cfg); }
public IComponentCfg DefaultConfig() { return new EntryFormCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
}
}
}

View File

@ -0,0 +1,132 @@
///
/// Copyright (c) 2022 Sensus Slovensko a.s.
///
using System.IO;
using System.Xml.Serialization;
using Common;
using Config.Entities;
using TBF.Rig.Generic;
namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
{
public class ProcParams : ProcedureParamsBase, IParamsProvider, IProcedureParams
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ProcParams) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public string OcrWorkspace; /// Path to a Cognex workspace file
public string OcrStream; /// Cognex workspace stream name
public override void InitializeAll()
{
OcrWorkspace = string.Empty;
OcrStream = "default";
}
string[] paramNames = new string[]
{
"OCR workspace file",
"OCR stream",
};
public override string ParamName(int i) { return paramNames[i]; }
public override int ParamsCount() { return paramNames.Length; }
public override string ToString(int i)
{
switch (i)
{
case 0: return OcrWorkspace;
case 1: return OcrStream;
default: return string.Empty;
}
}
public CfgUpdateFlags UpdateParam(int i, string str)
{
switch (i)
{
case 0: OcrWorkspace = str; return CfgUpdateFlags.None;
case 1: OcrStream = str; return CfgUpdateFlags.None;
default: return CfgUpdateFlags.None;
}
}
/// <summary>
/// Verifiy the string representation of the parameter
/// </summary>
/// <param name="i">Parameter ID</param>
/// <param name="str">String representation of the parameter</param>
/// <param name="message">In case false is returned this is the error messsage to be displayed</param>
/// <returns>true = parameter OK, false = parameter NOK</returns>
public bool ValidateParam(int i, string str, out string message)
{
message = string.Empty;
switch (i)
{
case 0:
return true;
case 1:
if (!string.IsNullOrEmpty(str)) return true;
break;
default:
message = "Invalid index";
return false;
}
message = ParamName(i) + " is invalid";
return false;
}
void CopyContentTo(ProcParams prms)
{
prms.OcrWorkspace = OcrWorkspace;
prms.OcrStream = OcrStream;
}
public IParamsProvider Clone()
{
ProcParams pars = new ProcParams();
CopyContentTo(pars);
return pars;
}
public override void UpdateFromDbEntity(ComponentProcedure dbEntity)
{
if (dbEntity == null) return;
try
{
ProcParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as ProcParams;
procedureParamsEntity = dbEntity;
componentName = dbEntity.CmpntName;
procedure = dbEntity.Procedure;
if (tmp != null) tmp.CopyContentTo(this);
}
catch
{
}
}
/// <summary>
/// Parameterless constructor initializes the parameters
/// </summary>
public ProcParams()
{
}
public ProcParams(bool initialize)
{
if (initialize) InitializeAll();
}
public ProcParams(ComponentProcedure procParamsEntity, string componentName, Procedure procedure)
{
this.procedureParamsEntity = procParamsEntity;
this.componentName = componentName;
this.procedure = procedure;
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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

@ -117,13 +117,14 @@ namespace TBF.Rig.Network.Camera.KeyenceIV3G120
cameraIdx = GetCameraIdx();
roisAndResults = new RoisAndResults();
if (CameraCfg.DebugLevel == DebugMode.Simulate)
/* if (CameraCfg.DebugLevel == DebugMode.Simulate)
{
UiBridge.Bridge.OnCameraInfo(cameraIdx,
string.Format("{0} s/n {1} si simulated", Name, CameraCfg.HardwareAddress));
return;
}
}*/
//TODO BUMI - refactor cameraDetected - it gives no sense
/// Detect a camera
bool cameraDetected = true;
@ -214,12 +215,17 @@ namespace TBF.Rig.Network.Camera.KeyenceIV3G120
public void Start()
{
throw new System.NotImplementedException();
running = true;
stopRtpListenerFlag = false;
StartRtpListener();
log.DebugFormat("Camera Start() - new implementation! ");
}
public Event Run()
{
throw new System.NotImplementedException();
log.DebugFormat("Camera Run() - new implementation! ");
return Event.Continue;
}
public void Stop()
@ -251,15 +257,16 @@ namespace TBF.Rig.Network.Camera.KeyenceIV3G120
try
{
//Try to find picture candidate, shout be on FTP
Image image = null;
string[] picCandidates = Directory.GetFiles(pathDir, "*.bmp", SearchOption.TopDirectoryOnly);
if (picCandidates.Length == 1 && picCandidates.Any(pic => pic == lastImageRtpListener))
if (picCandidates == null || (picCandidates.Length == 1 && picCandidates.Any(pic => pic == lastImageRtpListener)))
{
continue;
}
picCandidates = picCandidates.Where(pic => Regex.IsMatch(pic, searchPattern)).ToArray();
if (picCandidates != null && picCandidates.Length > 0)
{
Image image = null;
string newCandidate = CameraUtils.GetLastCreationTimeCandidate(picCandidates);
if (newCandidate == lastImageRtpListener)
{
@ -268,20 +275,19 @@ namespace TBF.Rig.Network.Camera.KeyenceIV3G120
log.Debug($"RtpListener - in Cycle, newCandidate: {newCandidate}");
try
{
log.DebugFormat("Image copy starting! Image exist: {0}",image!=null?"true":"false");
CameraUtils.WaitForImageCompleteOnDisk(newCandidate);
using (Image originalImage = Image.FromFile(newCandidate))
{
// Create a new bitmap from the loaded image
using (Bitmap bitmapCopy = new Bitmap(originalImage))
{
// Create an Image object from the Bitmap object (bitmapCopy)
image = bitmapCopy.Clone() as Image;
}
}
image = CreateCopyOfImage(newCandidate);
}
catch (OutOfMemoryException ex)
{
log.Error("Out of memory error when loading image: " + ex.Message);
image = null;
}
catch (Exception ex)
{
log.Error("Error loading image: " + ex.Message);
image = null;
}
@ -298,9 +304,22 @@ namespace TBF.Rig.Network.Camera.KeyenceIV3G120
grph.DrawRectangle(pen, overlayRect);
}
}
log.Debug($"Image success!, size: {image.Size.ToString()}");
UiBridge.Bridge.OnImage(this.cameraIdx, image);
lastImageRtpListener = newCandidate;
if (image != null)
{
try
{
UiBridge.Bridge.OnImage(this.cameraIdx, image);
lastImageRtpListener = newCandidate;
log.Debug($"Image success!, size: {image?.Size.ToString()}");
}
catch (Exception ex)
{
log.ErrorFormat("Exception in MJpeg RTP calling Bridge.OnImage(): {0}", ex.StackTrace);
image?.Dispose();
log.Error("Exception in MJpeg RTP calling Bridge.OnImage() dispose cleanUp done!");
}
}
}
}
catch (Exception exc)
@ -313,6 +332,20 @@ namespace TBF.Rig.Network.Camera.KeyenceIV3G120
log.Debug($"RtpListener - finished, stopRtpListenerFlag: {stopRtpListenerFlag}");
return;
}
private Image CreateCopyOfImage(string newCandidate)
{
using (Image originalImage = Image.FromFile(newCandidate))
{
// Create a new bitmap from the loaded image
using (Bitmap bitmapCopy = new Bitmap(originalImage))
{
// Create an Image object from the Bitmap object (bitmapCopy)
return bitmapCopy.Clone() as Image;
}
}
}
}
}

View File

@ -43,7 +43,7 @@ namespace TBF.Rig.Network.Camera.KeyenceIV3G120
catch (IOException ex)
{
// Handle the case when the file is not ready or cannot be accessed
log.Debug("No accessing rihts! We will wait next iteration!");
log.Error("No accessing rihts! We will wait next iteration!");
}
}
}

View File

@ -37,17 +37,30 @@ namespace TBF.Rig.Network.Camera.KeyenceIV3G120
if ((imgFileNames != null) && (imgFileNames.Length > 0) && File.Exists(imgFileNames[0]))
{
///
/// An image specified, (1) delete previous image, (2) check if this is a simulation
///
File.Delete(imgFileNames[0]);
if (camera.CameraCfg.DebugLevel == DebugMode.Simulate || camera.CameraCfg.DebugLevel == DebugMode.DetectedOff)
try
{
///
/// Camera is in simulation mode => create a simulated image
/// An image specified, (1) delete previous image, (2) check if this is a simulation
/// If Exist Image on destination fileName path, delete this file
///
File.Copy(string.Format("{0}\\Pictures\\sample.jpg", Program.ExecutableDir), imgFileNames[0]);
log.DebugFormat("Deleting destination image if exist, path: {0}", imgFileNames[0]);
File.Delete(imgFileNames[0]);
/* if (camera.CameraCfg.DebugLevel == DebugMode.Simulate ||
camera.CameraCfg.DebugLevel == DebugMode.DetectedOff)
{
///
/// Camera is in simulation mode => create a simulated image
///
string sampleImagePath = string.Format("{1}\\Pictures\\sample{0}.bmp",
imgFileNames[0].Contains("-end.bmp") ? "-end" : "", Program.ExecutableDir);
File.Copy( sampleImagePath, imgFileNames[0]);
log.DebugFormat("Camera is in simulation mode - sample image:{0}, to file: {1} ", sampleImagePath, imgFileNames[0]);
}*/
}
catch (Exception e)
{
log.Error("Error deleting image / copy sample.bmp: " + e.Message);
}
}
}
@ -61,14 +74,14 @@ namespace TBF.Rig.Network.Camera.KeyenceIV3G120
///
return Event.GrabPassed;
}
else if (camera.CameraCfg.DebugLevel == DebugMode.Simulate ||
/* else if (camera.CameraCfg.DebugLevel == DebugMode.Simulate ||
camera.CameraCfg.DebugLevel == DebugMode.DetectedOff)
{
///
/// Camera is in simulation mode => create a simulated image and complete
///
return Event.GrabPassed;
}
}*/
else if (!grabImageDone)
{
string pathDir = $"{Camera.FtpCameraSource}{Camera.PrefixCameraFolder}{camera.CameraIdx}\\";
@ -79,11 +92,13 @@ namespace TBF.Rig.Network.Camera.KeyenceIV3G120
if (picCandidates != null && picCandidates.Length > 0)
{
string newCandidate = CameraUtils.GetLastCreationTimeCandidate(picCandidates);
log.Debug($"GrabImageOP.Run() - in Cycle, newCandidate: {newCandidate}");
log.Debug($"Run() in Cycle, newCandidate: {newCandidate}");
try
{
CameraUtils.WaitForImageCompleteOnDisk(newCandidate);
log.DebugFormat("Run() TRY newCandidate move to fileName:{0}", imgFileNames[0]);
File.Move(newCandidate, imgFileNames[0]);
log.DebugFormat("Run() newCandidate moved completly into new fileName:{0}", imgFileNames[0]);
grabImageDone = true;
grabPassed = true;
CameraUtils.ClearDir(pathDir);
@ -91,13 +106,18 @@ namespace TBF.Rig.Network.Camera.KeyenceIV3G120
}
catch (Exception ex)
{
log.Error("Error loading image: " + ex.Message);
//TODO BUMI add beck Event.Error
log.Error("Error (Event.Error) loading image: " + ex.Message);
grabFailed = true;
return Event.Error;
return Event.GrabPassed; //Event.Error -- FAKE
}
}
return Event.CameraBusy;
}
else if (grabImageDone)
{
return Event.GrabPassed;
}
return Event.CameraBusy;
}

View File

@ -0,0 +1,10 @@
using Config.Entities;
using TBF.Rig.Generic;
namespace TBF.Rig.Sequences
{
public interface IProcedureCameraCollect : ISequence
{
void DefineParentProcess(Procedure parentProcedure);
}
}

View File

@ -0,0 +1,10 @@
using System;
using TBF.Rig.Generic;
namespace TBF.Rig.Sequences
{
public interface IProcedureCameraShowAfter : ISequence
{
Boolean IsSupportedCollector(IComponent component);
}
}

View File

@ -0,0 +1,7 @@
namespace TBF.Rig.Sequences
{
public interface ISequence
{
}
}

View File

@ -12,6 +12,7 @@ using Config.Entities;
using TBF.Rig.Operations;
using TBF.Rig.GenericDevices;
using TBF.Resources;
using TBF.Rig.Generic;
using TBF.Rig.Output.Printers.GroupPrinting.Single;
using TBF.UiBridge;
@ -173,6 +174,7 @@ namespace TBF.Rig.Sequences
string message;
if (TestCommunicationWithScales(out scaleName, out message) == false)
{
log.ErrorFormat("Error state on scale:{0} : {1}", scaleName, message);
Bridge.OnError(this, string.Format("{0} : {1}", scaleName, message));
goto error;
}
@ -864,6 +866,12 @@ namespace TBF.Rig.Sequences
goto select_cycle_or_test;
}
}
/*
* Data Collector AFTER ? if exist, then check collector and test
*/
bool collectDataAfterTests = false;
TBF.Rig.Generic.IComponent collector = TbfComponents.FindFirstComponentImpl<IProcedureCameraCollect>();
int currentTestIx = selsctedTestIx;
while (currentTestIx < StateMachine.TestInstances.Length - simultWithEvacuationCount)
@ -994,6 +1002,12 @@ namespace TBF.Rig.Sequences
log.InfoFormat("Test {0}: Execute(., {1}, {2})", testInst.Name, testInst.Repetition, isLastRepetition);
e = testMethod.Execute(testInst.Test, testInst.Repetition, isLastRepetition);
if (testMethod is IProcedureCameraShowAfter)
{
collectDataAfterTests = collectDataAfterTests ? true : (testMethod as IProcedureCameraShowAfter).IsSupportedCollector(collector);
log.InfoFormat("Set After test method done! Name: {0}, Do collect: {1}", testMethod.Name,collectDataAfterTests);
}
if (e.Contains(Event.MakeSecondPass) && testMethod is ITestMethodWith2ndPass)
{
@ -1091,7 +1105,31 @@ namespace TBF.Rig.Sequences
}
deferredData.Clear();
}
//ON THE END run collector process if is actual
if (collector != null && collectDataAfterTests)
{
IProcedureCameraCollect collectorParent = collector as IProcedureCameraCollect;
collectorParent.DefineParentProcess(StateMachine.Procedure);
for (int i = 0; i < StateMachine.TestInstances.Length - simultWithEvacuationCount; i++)
{
try
{
Test test = StateMachine.TestInstances[i].Test;
TestInstance testInst = StateMachine.TestInstances[i];
ITestMethod testMethod = collector as ITestMethod; //Found Process to run - data collection
log.InfoFormat("Test {0}: Execute(., {1}, {2})", testInst.Name, testInst.Repetition, true);
e = testMethod.Execute(testInst.Test, testInst.Repetition, true);
}
catch (Exception exception)
{
log.ErrorFormat("Read ",exception);
}
}
}
}
///------------------------------------------------------------------------------------------------------------
else
{
@ -1138,6 +1176,12 @@ namespace TBF.Rig.Sequences
StartMass.Format = "F3";
EndMass.Format = "F3";
/*
* Data Collector AFTER ? if exist, then check collector and test
*/
bool collectDataAfterTests = false;
TBF.Rig.Generic.IComponent collector = TbfComponents.FindFirstComponentImpl<IProcedureCameraCollect>();
ITestMethod testMethod = TbfComponents.FindComponent(test.Method) as ITestMethod;
if (testMethod != null && testMethod.CanTest(StateMachine.Procedure.MetersKind))
{
@ -1175,6 +1219,12 @@ namespace TBF.Rig.Sequences
{
e = testMethod.Execute(test, repetNr, true);
if (testMethod is IProcedureCameraShowAfter)
{
collectDataAfterTests = collectDataAfterTests ? true : (testMethod as IProcedureCameraShowAfter).IsSupportedCollector(collector);
log.InfoFormat("Set After test method done! Name: {0}, Do collect: {1}", testMethod.Name,collectDataAfterTests);
}
if (e.Contains(Event.MakeSecondPass) && testMethod is ITestMethodWith2ndPass)
{
ITestMethodWith2ndPass tm2 = testMethod as ITestMethodWith2ndPass;
@ -1190,6 +1240,29 @@ namespace TBF.Rig.Sequences
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetNr, testFinished ? Progress.Completed
: Progress.Aborted));
//ON THE END run collector process if is actual (defined and actual process supports it)
if (testFinished && collector != null && collectDataAfterTests)
{
IProcedureCameraCollect collectorParent = collector as IProcedureCameraCollect;
collectorParent.DefineParentProcess(StateMachine.Procedure);
ITestMethod testMethodCollector = collector as ITestMethod;
if (testMethodCollector != null &&
testMethodCollector.CanTest(StateMachine.Procedure.MetersKind))
{
try
{
log.InfoFormat("Test single {0}: Execute(., {1}, {2})", test.Name, repetNr,
true);
e = testMethodCollector.Execute(test, repetNr, true);
}
catch (Exception exception)
{
log.ErrorFormat("Read ", exception);
}
}
}
if (testMethod.DoTransitions())
{
TransitionContext endContext = testFinished ? TransitionContext.AfterTest : TransitionContext.Stop;
@ -1493,6 +1566,7 @@ namespace TBF.Rig.Sequences
goto select_cycle_or_test;
error:
log.Error("Error tag in MainSequence!");
//--------------------------------
State.Create("MainSeq : ERROR -> Closing the valves")
.AddOperation(checkUiOp)

View File

@ -374,6 +374,7 @@ namespace TBF.Rig.Sequences
if (e.Contains(Event.Error))
{
log.Error("Error state in main sequence! ");
///------------------------------------
Bridge.OnActivity(this, Strings.Error);
///------------------------------------

View File

@ -6,6 +6,7 @@ using System.Linq;
using Common;
using Config.Entities;
using TBF.Rig.Generic;
using TBF.Rig.Sequences;
namespace TBF.Rig
{
@ -43,6 +44,7 @@ namespace TBF.Rig
new DataEntry.Standard48.Factory(),
new DataEntry.Standard48.FactoryNoStartEnd(),
new DataEntry.StandardCamera.Factory(),
new DataEntry.StandartCameraPurchaseOrder.Factory(),
new DataEntry.Uni.Factory(),
new DataEntry.Uni.FactoryNoStartEnd(),
new RegisterReaders.KPackE.DataEntryForRadio.Factory(), /// DataEntry for KPackE radio
@ -339,5 +341,34 @@ namespace TBF.Rig
{
return FindComponent(name, StateMachine.Components);
}
public static IComponent FindFirstComponentImpl<T>(IList<IComponent> components) where T : class, ISequence
{
foreach (var component in components)
{
if (component is T)
{
return component;
}
}
return null;
}
public static IComponent FindFirstComponentImpl<T>() where T : class, ISequence
{
return FindFirstComponentImpl<T>(StateMachine.Components);
}
public static IComponent FindFirstComponentImpl()
{
foreach (var component in StateMachine.Components)
{
if (component is IProcedureCameraCollect)
{
return component;
}
}
return null;
}
}
}

View File

@ -6,15 +6,18 @@ using System.Collections.Generic;
using log4net;
using Common;
using Config.Entities;
using TBF.Rig.Generic;
using TBF.Rig.Sequences;
namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance.Single
{
public class Component : ComponentBase, GenericDevices.ITestMethod
public class Component : ComponentBase, GenericDevices.ITestMethod, IProcedureCameraShowAfter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool IsSupportedCollector(IComponent component) { return (component is IProcedureCameraCollect); }
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
public bool DoTransitions() { return true; }
public bool CheckDeviceCaps(Test test, OutputPath devices, out string message)
{

View File

@ -10,7 +10,9 @@ using Common;
using Config.Entities;
using TBF.Boxes;
using TBF.Resources;
using TBF.Rig.Generic;
using TBF.Rig.GenericDevices;
using TBF.Rig.Sequences;
using TBF.UiBridge;
namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance
@ -490,13 +492,17 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance
if (dataEntryCmpnt != null)
{
string fileName = string.Format("{0}-{1}-start.bmp", test.Name, repetitionNr); //string.Format("{0}-start.bmp", test.Name);
string fileName = (dataEntryCmpnt as IDataEntryForCamera).TestStartImgName(repetitionNr, testName).Replace(' ','_').Replace('/','_');;
//string fileName = string.Format("{0}-{1}-start.bmp", test.Name, repetitionNr); //string.Format("{0}-start.bmp", test.Name);
IValve triggerValve = null;
bool triggerSend = false;
if (dataEntryCmpnt is GenericDevices.IDataEntryForCamera)
{
string[] startImages = new string[sensPath.RegisterReaders.Length];
State state2 = State.Create(string.Format("{0}({1}) : Grab images", test.Method, test.Name))
.AddOperation(checkUiOp)
@ -507,6 +513,10 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
{
string directory = Path.Combine(Program.TempImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
Directory.CreateDirectory(directory);
startImages[i] = Path.Combine(directory, fileName);
GenericDevices.IRegReaderStillCamera roi = sensPath.RegisterReaders[i] as GenericDevices.IRegReaderStillCamera;
if (roi != null)
{
@ -518,17 +528,14 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance
string.Format("{0}({1}) : Grabbing images - valve open", test.Method, test.Name));
triggerSend = true;
}
string directory = Path.Combine(Program.TempImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
Directory.CreateDirectory(directory);
startImages[i] = Path.Combine(directory, fileName);
state2.AddOperation(roi.GrabImageOp(startImages[i]));
log.DebugFormat("Camera GrabImage, startImages[{0}] = {1} ", i, startImages[i]);
}
else
{
/// Camera simulation
string directory = Path.Combine(Program.TempImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
Directory.CreateDirectory(directory);
startImages[i] = Path.Combine(directory, fileName);
log.DebugFormat("Camera GrabImage no ROI - in Simulation Mode, startImages[{0}] = {1} ", i, startImages[i]);
}
}
state2.EnterState();
@ -552,22 +559,22 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance
string.Format("{0}({1}) : Grabbing images - valve close", test.Method, test.Name));
}
///////
Bridge.OnActivity(this, Strings.Enter_water_meter_data);
Bridge.OnActivity(this, Strings.Grabbing_images);//Strings.Enter_water_meter_data);
State.Create(string.Format("{0}({1}) : Enter start states of water meters", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(readStartMassOp)
.AddOperation(testInProgress)
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp(sensPath.RegisterReaders))
//.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp(sensPath.RegisterReaders))
.AddOperation(processDataLoggingOp)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.ModelessFormClosed));
while (!e.Contains(Event.ScaleDone/*Event.ModelessFormClosed*/));
if (heatMetersTestParams != null)
{
@ -601,12 +608,12 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance
{
(rr as Rig.Network.Camera.RoiForFixedStartKeyence.Roi).BeginWMState =
dataEntryCmpnt.WMStartState(i);
log.DebugFormat(" StandingStartMassCollectionAdvanceSeq.cs - BeginWMState [{0}] -> RoiForFixedStartKeyence.Roi",dataEntryCmpnt.WMStartState(i));
log.DebugFormat("BeginWMState [{0}] -> RoiForFixedStartKeyence.Roi",dataEntryCmpnt.WMStartState(i));
}
}
}
if (dataEntryCmpnt is IDataEntryForCamera && (dataEntryCmpnt as IDataEntryForCamera).SaveImages)
if (dataEntryCmpnt is IDataEntryForCamera /*&& (dataEntryCmpnt as IDataEntryForCamera).SaveImages*/)
{
log.Debug("Save images WMStartState...");
/// SaveImages==true ... copy images to the directory that will be archived at the end of the cycle
@ -624,13 +631,18 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance
Directory.CreateDirectory(destDir);
string destFName = string.IsNullOrEmpty((dataEntryCmpnt as IDataEntryForCamera).TestStartImgName(i, testName))
? fileName : (dataEntryCmpnt as IDataEntryForCamera).TestStartImgName(i, testName);
File.Copy(Path.Combine(srcDir, fileName), Path.Combine(destDir, destFName), true);
string destFNameComp = destFName.Replace(' ', '_').Replace('/','_');
File.Copy(Path.Combine(srcDir, fileName), Path.Combine(destDir, destFNameComp), true);
log.DebugFormat("Save images sourceFile: {0}, destFile: {1} ",Path.Combine(srcDir, fileName), Path.Combine(destDir, destFName));
}
else
{
log.DebugFormat("No image file name: {0} to copy from: {1}", fileName, srcDir);
}
}
catch (Exception exc)
{
log.ErrorFormat("Failed to copy image {0} to {1}: {2}", fileName, destDir, exc.Message);
log.ErrorFormat("Failed to copy image {0} to {1} error message: {2}", fileName, destDir, exc.Message);
}
}
}
@ -817,7 +829,9 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance
///
if (dataEntryCmpnt != null)
{
string fileName = string.Format("{0}-{1}-end.bmp", test.Name, repetitionNr); //string.Format("{0}-end.bmp", test.Name);
string fileName = (dataEntryCmpnt as IDataEntryForCamera).TestEndImgName(repetitionNr, testName).Replace(' ','_').Replace('/','_');
//string fileName = string.Format("{0}-{1}-end.bmp", test.Name, repetitionNr); //string.Format("{0}-end.bmp", test.Name);
IValve triggerValve = null;
bool triggerSend = false;
@ -826,9 +840,14 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance
string[] endImages = new string[sensPath.RegisterReaders.Length];
State state2 = State.Create(string.Format("{0}({1}) : Grabbing images", test.Method, test.Name))
.AddOperation(checkUiOp);
.AddOperation(checkUiOp)
.AddOperation(testInProgress);
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
{
string directory = Path.Combine(Program.TempImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
Directory.CreateDirectory(directory);
endImages[i] = Path.Combine(directory, fileName);
GenericDevices.IRegReaderStillCamera roi = sensPath.RegisterReaders[i] as GenericDevices.IRegReaderStillCamera;
if (roi != null)
{
@ -840,18 +859,14 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance
string.Format("{0}({1}) : Grabbing images - valve open", test.Method, test.Name));
triggerSend = true;
}
string directory = Path.Combine(Program.TempImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
Directory.CreateDirectory(directory);
endImages[i] = Path.Combine(directory, fileName);
state2.AddOperation(roi.GrabImageOp(endImages[i]));
state2.AddOperation(testInProgress);
log.DebugFormat("Camera GrabImage, endImages[{0}] = {1} ", i, endImages[i]);
}
else
{
/// Camera simulation
string directory = Path.Combine(Program.TempImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
Directory.CreateDirectory(directory);
endImages[i] = Path.Combine(directory, fileName);
log.DebugFormat("Camera GrabImage no ROI - in Simulation Mode, endImages[{0}] = {1} ", i, endImages[i]);
}
}
state2.EnterState();
@ -875,10 +890,10 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance
string.Format("{0}({1}) : Grabbing images - valve close", test.Method, test.Name));
}
///////
Bridge.OnActivity(this, Strings.Enter_water_meter_data);
Bridge.OnActivity(this, Strings.Grabbing_images); //Strings.Enter_water_meter_data);
State state = State.Create(string.Format("{0}({1}) : Entering the end-state", test.Method, test.Name));
if (heatMetersTestParams != null && dataEntryCmpnt is GenericDevices.IHasHeatMtrStatesForm)
/*if (heatMetersTestParams != null && dataEntryCmpnt is GenericDevices.IHasHeatMtrStatesForm)
{
state.AddOperation((dataEntryCmpnt as GenericDevices.IHasHeatMtrStatesForm).
ShowTestEndFormOp(sensPath.RegisterReaders,
@ -889,7 +904,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance
{
state.AddOperation(dataEntryCmpnt.ShowTestEndFormOp(sensPath.RegisterReaders,
volumeCTV, test.ErrLimLo + test.Uncertainty, test.ErrLimHi - test.Uncertainty));
}
}*/
state.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(testInProgress)
@ -898,7 +913,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.ModelessFormClosed));
while (!e.Contains(Event.TestInProgress/*Event.ModelessFormClosed*/));
if (heatMetersTestParams != null)
@ -922,13 +937,13 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance
{
for (int i = 0; i < waterMetersCount; i++)
{
GenericDevices.IRegReader rr = sensPath.RegisterReaders[i];
GenericDevices.IRegReader rr = sensPath.RegisterReaders[i];
if (rr is Rig.RegisterReaders.StandingStartStop.RegisterReader)
(rr as Rig.RegisterReaders.StandingStartStop.RegisterReader).EndWMState = dataEntryCmpnt.WMEndState(i);
if (rr is Rig.RegisterReaders.StandingStartStop.RegisterReader)
(rr as Rig.RegisterReaders.StandingStartStop.RegisterReader).EndWMState = dataEntryCmpnt.WMEndState(i);
if (rr is Rig.Network.Camera.RoiForFixedStart.Roi)
(rr as Rig.Network.Camera.RoiForFixedStart.Roi).EndWMState = dataEntryCmpnt.WMEndState(i);
if (rr is Rig.Network.Camera.RoiForFixedStart.Roi)
(rr as Rig.Network.Camera.RoiForFixedStart.Roi).EndWMState = dataEntryCmpnt.WMEndState(i);
if (rr is Rig.Network.Camera.RoiForFixedStartKeyence.Roi)
{
@ -939,7 +954,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance
}
}
if (dataEntryCmpnt is IDataEntryForCamera && (dataEntryCmpnt as IDataEntryForCamera).SaveImages)
if (dataEntryCmpnt is IDataEntryForCamera /*&& (dataEntryCmpnt as IDataEntryForCamera).SaveImages*/)
{
log.Debug("Save images EndWMState...");
/// SaveImages==true ... copy images to the directory that will be archived at the end of the cycle
@ -957,6 +972,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance
Directory.CreateDirectory(destDir);
string destFName = string.IsNullOrEmpty((dataEntryCmpnt as IDataEntryForCamera).TestEndImgName(i, testName))
? fileName : (dataEntryCmpnt as IDataEntryForCamera).TestEndImgName(i, testName);
destFName = destFName.Replace(' ', '_').Replace('/', '_');
File.Copy(Path.Combine(srcDir, fileName), Path.Combine(destDir, destFName), true);
log.DebugFormat("Save images sourceFile: {0}, destFile: {1} ",Path.Combine(srcDir, fileName), Path.Combine(destDir, destFName));
}

View File

@ -6,16 +6,23 @@ using System.Collections.Generic;
using log4net;
using Common;
using Config.Entities;
using TBF.Rig.Sequences;
namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvanceCollect.Single
{
public class Component : ComponentBase, GenericDevices.ITestMethod
public class Component : ComponentBase, GenericDevices.ITestMethod, IProcedureCameraCollect
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
private Procedure parentProcedure;
public void DefineParentProcess(Procedure parentProcedure)
{
this.parentProcedure = parentProcedure;
}
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
public bool DoTransitions() { return true; }
public bool CheckDeviceCaps(Test test, OutputPath devices, out string message)
{
@ -34,7 +41,9 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvanceCollect.Single
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new StandingStartMassCollectionAdvanceCollectSeq()).Execute(test, repetNr, isLastRepetition, DebugLevel);
StandingStartMassCollectionAdvanceCollectSeq startMassCollectionAdvanceCollectSeq = new StandingStartMassCollectionAdvanceCollectSeq();
startMassCollectionAdvanceCollectSeq.DefineParentProcess(parentProcedure);
return startMassCollectionAdvanceCollectSeq.Execute(test, repetNr, isLastRepetition, DebugLevel);
}
}
}

View File

@ -4,20 +4,21 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using log4net;
using Common;
using Config.Entities;
using TBF.Boxes;
using TBF.Resources;
using TBF.Rig.GenericDevices;
using TBF.Rig.Sequences;
using TBF.UiBridge;
namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvanceCollect
{
public class StandingStartMassCollectionAdvanceCollectSeq : Sequences.SequenceBase
public class StandingStartMassCollectionAdvanceCollectSeq : Sequences.SequenceBase, ISequence
{
private static readonly ILog log = LogManager.GetLogger(typeof(StandingStartMassCollectionAdvanceCollectSeq));
private Procedure parentProcedure;
/// <summary>
/// Check capabilities of devces in the output path required for this test method
@ -26,49 +27,6 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvanceCollect
/// <returns>true when capabilities of devices are OK</returns>
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
{
if (!(StateMachine.ControlBoardMain is ControlBoard.Papouch.PapouchCB) &&
!(StateMachine.ControlBoardMain is ControlBoard.Uni.UniCB))
{
/// Control board does not support this method
message = string.Format("{0}: {1}", test.Name, Strings.Test_bench_does_not_suport_selected_test_method);
return false;
}
if (!(devices.Scale is IScale))
{
/// Scale is missing
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_scale);
return false;
}
if (test.Volume > devices.Scale.Capacity * Constants.TankFullFactor)
{
/// Scale capacity is not sufficient
message = string.Format("{0}: {1}", test.Name, Strings.Test_volume_exceeds_the_scale_capacity);
return false;
}
if (!(devices.Diverter is IDiverter))
{
/// Diverter is missing
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_diverter);
return false;
}
if (!(devices.FlowMeter is IFlowMeter))
{
/// Flow meter is missing
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_flow_meter);
return false;
}
if (!(devices.RegValve is GenericDevices.IRegValve))
{
/// Regulation valve is missing
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
return false;
}
message = string.Empty;
return true;
}
@ -87,54 +45,19 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvanceCollect
public IList<Event> Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition,
Common.DebugMode debugLevel)
{
ControlBoard.IControlBoard cBrd = StateMachine.ControlBoardMain;
IScale scale = cBrd.Devices.Scale as IScale;
if ((outPath.FlowMeter is IFlowMeterSingle) &&
(outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi) == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
IList<Event> e; /// Events from currently running operations
int waterMetersCount = Math.Min(BenchInfo.WaterMetersCount, sensPath.RegisterReaders.Length);
DateTimeBox timeStampStart = new DateTimeBox();
DateTimeBox timeStampEnd = new DateTimeBox();
FloatBox startSwitchTime = new FloatBox();
FloatBox stopSwitchTime = new FloatBox();
int tMass1 = 0;
int tMass2 = 0;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
log.DebugFormat("WaitRunDevsRunOps - initialisation");
e = StateMachine.WaitRunDevsRunOps();
log.DebugFormat("WaitRunDevsRunOps - initialisation done");
if (cBrd is ControlBoard.Uni.UniCB)
{
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
if (sensPath != null && sensPath.RegisterReaders != null)
{
foreach (var rr in sensPath.RegisterReaders)
{
IRegReaderPulses rrPls = rr as IRegReaderPulses;
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
{
filters[rrPls.Position - 1] = rrPls.Filter;
}
}
}
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
}
log.DebugFormat("ControlBoard.Uni.UniCB - initialisation done");
Event retVal = Event.Done;
int totalPulses = Convert.ToInt32(test.Volume / outPath.FlowMeter.LtrPerPulse);
///============================================================================================
@ -143,34 +66,48 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvanceCollect
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
log.DebugFormat("Start the test - testName: {0}, test -> name: {1} -> Repeats: {2} -> repetitionNr: {3}", testName, test.Name, test.Repeats, repetitionNr);
IOperation testInProgress = cBrd.StandingStartStopTestOp(test, 2 * totalPulses, Devices.Diverter is TBF.Rig.Uni.Diverter.Diverter);
Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(testName, test.Part);
///
/// Enter water meter begin states and read the start mass at the same time
///
GenericDevices.IHasWMStatesForm dataEntryCmpnt = TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IHasWMStatesForm;
IOperation readStartMassOp = scale.ReadStableMassOp(ref StartMass, test.TimeFlow2Mass, test.MassMethod, test.MassRepeats, test.MassSpread);
log.DebugFormat("Collect process - Enter watermeter end states here");
///
/// Enter watermeter end states here
/// Enter watermeter start - end states here
///
if (dataEntryCmpnt != null)
{
string fileName = string.Format("{0}-{1}-end.bmp", test.Name, repetitionNr); //string.Format("{0}-end.bmp", test.Name);
IValve triggerValve = null;
bool triggerSend = false;
if (dataEntryCmpnt is GenericDevices.IDataEntryForCamera)
{
string[] startImages = new string[sensPath.RegisterReaders.Length];
string[] endImages = new string[sensPath.RegisterReaders.Length];
(dataEntryCmpnt as GenericDevices.IDataEntryForCamera).EndImages = endImages;
}
log.Debug("Save images EndWMState...");
/// SaveImages==true ... copy images to the directory that will be archived at the end of the cycle
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
{
var roi = sensPath.RegisterReaders[i] as IRegReaderStillCamera;
if (roi != null)
{
string pathImage= Path.Combine(Program.ImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
string endTestdestFName = (dataEntryCmpnt as IDataEntryForCamera).TestEndImgName(i, testName).Replace(' ','_').Replace('/','_');
log.DebugFormat("End test image {1} - destination file name to fileName: {0} filepath: {2}", endTestdestFName,i, pathImage);
endImages[i] = pathImage +"\\"+ endTestdestFName;
string startTestdestFName = (dataEntryCmpnt as IDataEntryForCamera).TestStartImgName(i, testName).Replace(' ','_').Replace('/','_');;
log.DebugFormat("Start test image {1} - destination file name to filePath: {0} filePath: {2}", startTestdestFName,i, pathImage);
startImages[i] = pathImage +"\\"+ startTestdestFName;
}
}
(dataEntryCmpnt as GenericDevices.IDataEntryForCamera).EndImages = endImages;
(dataEntryCmpnt as GenericDevices.IDataEntryForCamera).StartImages = startImages;
}
@ -183,7 +120,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvanceCollect
}
state.AddOperation(checkUiOp)
//.AddOperations(readTempPressOps)
.AddOperation(testInProgress)
//.AddOperation(testInProgress)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
@ -198,50 +135,32 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvanceCollect
{
GenericDevices.IRegReader rr = sensPath.RegisterReaders[i];
if (rr is Rig.RegisterReaders.StandingStartStop.RegisterReader)
(rr as Rig.RegisterReaders.StandingStartStop.RegisterReader).EndWMState = dataEntryCmpnt.WMEndState(i);
if (rr is Rig.RegisterReaders.StandingStartStop.RegisterReader)
{
(rr as Rig.RegisterReaders.StandingStartStop.RegisterReader).EndWMState = dataEntryCmpnt.WMEndState(i);
(rr as Rig.RegisterReaders.StandingStartStop.RegisterReader).BeginWMState = dataEntryCmpnt.WMStartState(i);
}
if (rr is Rig.Network.Camera.RoiForFixedStart.Roi)
(rr as Rig.Network.Camera.RoiForFixedStart.Roi).EndWMState = dataEntryCmpnt.WMEndState(i);
if (rr is Rig.Network.Camera.RoiForFixedStart.Roi)
{
(rr as Rig.Network.Camera.RoiForFixedStart.Roi).EndWMState = dataEntryCmpnt.WMEndState(i);
(rr as Rig.Network.Camera.RoiForFixedStart.Roi).BeginWMState = dataEntryCmpnt.WMStartState(i);
}
if (rr is Rig.Network.Camera.RoiForFixedStartKeyence.Roi)
{
(rr as Rig.Network.Camera.RoiForFixedStartKeyence.Roi).EndWMState =
dataEntryCmpnt.WMEndState(i);
log.DebugFormat(" StandingStartMassCollectionAdvanceSeq.cs - EndWMState [{0}] -> RoiForFixedStartKeyence.Roi",dataEntryCmpnt.WMEndState(i));
(rr as Rig.Network.Camera.RoiForFixedStartKeyence.Roi).BeginWMState =
dataEntryCmpnt.WMStartState(i);
log.DebugFormat(" StandingStartMassCollectionAdvanceSeq.cs - BeginWMState [{0}], EndWMState [{1}] -> RoiForFixedStartKeyence.Roi",dataEntryCmpnt.WMStartState(i),dataEntryCmpnt.WMEndState(i));
}
}
}
if (dataEntryCmpnt is IDataEntryForCamera && (dataEntryCmpnt as IDataEntryForCamera).SaveImages)
{
log.Debug("Save images EndWMState...");
/// SaveImages==true ... copy images to the directory that will be archived at the end of the cycle
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
{
var roi = sensPath.RegisterReaders[i] as IRegReaderStillCamera;
if (roi != null)
{
string srcDir = Path.Combine(Program.TempImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
string destDir = Path.Combine(Program.ImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
try
{
if (File.Exists(Path.Combine(srcDir, fileName)))
{
Directory.CreateDirectory(destDir);
string destFName = string.IsNullOrEmpty((dataEntryCmpnt as IDataEntryForCamera).TestEndImgName(i, testName))
? fileName : (dataEntryCmpnt as IDataEntryForCamera).TestEndImgName(i, testName);
File.Copy(Path.Combine(srcDir, fileName), Path.Combine(destDir, destFName), true);
log.DebugFormat("Save images sourceFile: {0}, destFile: {1} ",Path.Combine(srcDir, fileName), Path.Combine(destDir, destFName));
}
}
catch (Exception exc)
{
log.ErrorFormat("Failed to copy image {0} to {1}: {2}", fileName, destDir, exc.Message);
}
}
}
}
}
//------------------------------------------------
@ -254,66 +173,11 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvanceCollect
///
/// Populate TestResult data entity with data
///
Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(testName, test.Part);
//Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(testName, test.Part);
bool stopCycle = false;
if (tstRslt != null)
{
Results.Utils.GetCounterStates(tstRslt, Program.LocalSettings.Counters);
/// Raw data
UpdateTempPressDensAmb(tstRslt);
tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName;
tstRslt.StartTime = TestStartTime;
tstRslt.EndTime = TestEndTime;
//tstRslt.FlowSetTime = flowSetTime;
tstRslt.TestTime = Math.Max(1.0, DateTimeBox.DurationSec(timeStampStart, timeStampEnd)); /// Min. 1s to prevent division by zero
tstRslt.PulsesMaster = Convert.ToDouble(cBrd.RefPulses); /// Pulses of the master flow meter (test total)
tstRslt.MassStartRaw = StartMass.Val;
tstRslt.MassEndRaw = EndMass.Val;
tstRslt.TimeBtwnMassMsrmnts = tMass2 - tMass1;
/// Corrected values
//tstRslt.MassStart = massStart;
// tstRslt.MassEnd = massEnd;
// tstRslt.MassOfEvapWater = massOfEvaporatedWater;
/// Main results
//tstRslt.VolumeCTV = volumeCTV; /// [l] 1000.0f is because density is in [kg/m3]
//tstRslt.Flow = 3.6 * volumeCTV / tstRslt.TestTime; /// [m3/h]
if (cBrd is ControlBoard.Uni.UniCB)
{
/// Test bench with Uni control board and q reference flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse;
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.Flow, tstRslt.TempDownMean);
tstRslt.VolumeMaster = tstRslt.ConstMasterRaw * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMaster = (tstRslt.VolumeMaster != 0) ? (tstRslt.ConstMasterRaw * tstRslt.VolumeCTV / tstRslt.VolumeMaster) : tstRslt.ConstMasterCorr;
}
else
{
/// Test bench with Papouch control board without reference flow meter
//tstRslt.VolumeMaster = volumeCTV; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = 1; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = 1; /// Corrected master pulses per liter
tstRslt.ConstMaster = 1;
}
tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
tstRslt.FlowMean = (float)RefFlowStat.Average;
tstRslt.FlowStart = (float)RefFlowStat.First;
tstRslt.FlowEnd = (float)RefFlowStat.Last;
tstRslt.FlowMin = (float)RefFlowStat.Min;
tstRslt.FlowMax = (float)RefFlowStat.Max;
tstRslt.DiverterStart = startSwitchTime.Val;
tstRslt.DiverterEnd = stopSwitchTime.Val;
long infoFlags = 0;
tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, false, true, startSwitchTime.Val, stopSwitchTime.Val, out infoFlags, out stopCycle) : 0;
tstRslt.InfoFlags = infoFlags;
{
///
/// Single meters
@ -327,34 +191,20 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvanceCollect
if (meterRslt != null && regReader != null)
{
meterRslt.RegReaderType = (int)regReader.RegisterReaderType;
meterRslt.PulsesPerLiter = regReader.PulsesPerLtr;
meterRslt.VolumeStart = regReader.BeginWMState;
meterRslt.VolumeEnd = regReader.EndWMState;
meterRslt.VolumeMeter = Math.Abs(meterRslt.VolumeEnd - meterRslt.VolumeStart);
meterRslt.VolumeRef = tstRslt.VolumeCTV; /// liter
meterRslt.PulsesMeter = meterRslt.VolumeMeter;
meterRslt.PulsesMaster = tstRslt.PulsesMaster;
meterRslt.TestTime = tstRslt.TestTime;
meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef);
meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.VolumeCTV, tstRslt.TestTime) + test.Uncertainty)
&& (meterRslt.Error <= test.GetErrLimHi(tstRslt.VolumeCTV, tstRslt.TestTime) - test.Uncertainty)
&& (tstRslt.ErrorFlags == 0);
meterRslt.TestDone = true;
tstRslt.TestDone = true;
}
}
}
tstRslt.Components = Results.Entities.Components
.UpdateList(BatchRslts.ComponentsList,
new Results.Entities.Components((BenchInfo != null) ? BenchInfo.TestBenchId : 1,
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
scale != null ? scale.Name : string.Empty,
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
/// Update water meter error flags
if (ErrorFlagsComp != null)
@ -392,5 +242,11 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvanceCollect
return new List<Event> { retVal };
}
public void DefineParentProcess(Procedure parentProcedure)
{
this.parentProcedure = parentProcedure;
}
}
}

View File

@ -545,6 +545,34 @@
<DependentUpon>TestStartEndForm.cs</DependentUpon>
</Compile>
<Compile Include="Rig\DataEntry\DEUtils.cs" />
<Compile Include="Rig\DataEntry\StandartCameraPurchaseOrder\CycleBeginningForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Rig\DataEntry\StandartCameraPurchaseOrder\CycleBeginningForm.designer.cs">
<DependentUpon>CycleBeginningForm.cs</DependentUpon>
</Compile>
<Compile Include="Rig\DataEntry\StandartCameraPurchaseOrder\CycleEndForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Rig\DataEntry\StandartCameraPurchaseOrder\CycleEndForm.designer.cs">
<DependentUpon>CycleEndForm.cs</DependentUpon>
</Compile>
<Compile Include="Rig\DataEntry\StandartCameraPurchaseOrder\EntryForm.cs" />
<Compile Include="Rig\DataEntry\StandartCameraPurchaseOrder\EntryFormCfg.cs" />
<Compile Include="Rig\DataEntry\StandartCameraPurchaseOrder\EntryFormCfgCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Rig\DataEntry\StandartCameraPurchaseOrder\EntryFormCfgCtrl.designer.cs">
<DependentUpon>EntryFormCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="Rig\DataEntry\StandartCameraPurchaseOrder\Factory.cs" />
<Compile Include="Rig\DataEntry\StandartCameraPurchaseOrder\ProcParams.cs" />
<Compile Include="Rig\DataEntry\StandartCameraPurchaseOrder\TestStartEndForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Rig\DataEntry\StandartCameraPurchaseOrder\TestStartEndForm.designer.cs">
<DependentUpon>TestStartEndForm.cs</DependentUpon>
</Compile>
<Compile Include="Rig\DataEntry\Uni\CycleBgEnForm.cs">
<SubType>Form</SubType>
</Compile>
@ -1175,6 +1203,9 @@
<Compile Include="Rig\Scales\WaitTankContainsMoreThenOp.cs" />
<Compile Include="Rig\Scales\WaitTankEmptyOp.cs" />
<Compile Include="Rig\Sequences\DeferredTestEvaluationData.cs" />
<Compile Include="Rig\Sequences\IProcedureCameraCollect.cs" />
<Compile Include="Rig\Sequences\IProcedureCameraShowAfter.cs" />
<Compile Include="Rig\Sequences\ISequence.cs" />
<Compile Include="Rig\Sequences\MainSeqUtils.cs" />
<Compile Include="Rig\Sequences\Plotter.cs" />
<Compile Include="Rig\Sequences\Statistics.cs" />
@ -2786,6 +2817,24 @@
<EmbeddedResource Include="Rig\DataEntry\StandardCamera\TestStartEndForm.resx">
<DependentUpon>TestStartEndForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rig\DataEntry\StandartCameraPurchaseOrder\CycleBeginningForm.pl.resx">
<DependentUpon>CycleBeginningForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rig\DataEntry\StandartCameraPurchaseOrder\CycleBeginningForm.resx">
<DependentUpon>CycleBeginningForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rig\DataEntry\StandartCameraPurchaseOrder\CycleBeginningForm.ru.resx">
<DependentUpon>CycleBeginningForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rig\DataEntry\StandartCameraPurchaseOrder\CycleEndForm.resx">
<DependentUpon>CycleEndForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rig\DataEntry\StandartCameraPurchaseOrder\EntryFormCfgCtrl.resx">
<DependentUpon>EntryFormCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rig\DataEntry\StandartCameraPurchaseOrder\TestStartEndForm.resx">
<DependentUpon>TestStartEndForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rig\DataEntry\Uni\CycleBgEnForm.resx">
<DependentUpon>CycleBgEnForm.cs</DependentUpon>
</EmbeddedResource>