Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
890b6016cf | ||
|
|
5efaac94cb |
+1
-7
@@ -38,18 +38,12 @@ namespace Config
|
||||
public const int CompoundWMsCount = 3;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = 3;
|
||||
#elif RUM_MOB
|
||||
#elif RUM_MOB || TURA_SPECIAL
|
||||
public const int WMsCount = 8;
|
||||
public const int LineSize = 8;
|
||||
public const int CompoundWMsCount = 1;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = WMsCount / LineSize;
|
||||
#elif TURA_SPECIAL
|
||||
public const int WMsCount = 6;
|
||||
public const int LineSize = 6;
|
||||
public const int CompoundWMsCount = 1;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = WMsCount / LineSize;
|
||||
#elif DEWA_300 || FUZHOU_100 || ROMA_200 || LUXEMBURG_40
|
||||
public const int WMsCount = 10;
|
||||
public const int LineSize = 10;
|
||||
|
||||
@@ -99,6 +99,7 @@ namespace Results.Entities
|
||||
public virtual int HydrPruefung { get; set; }
|
||||
#endif
|
||||
public virtual int ProcessId { get; set; } /// Not mapped to DB !!! Tracing DB Process ID
|
||||
public virtual int SessionId { get; set; } /// Not mapped to DB !!! 1 (regular tracing DB session) or 2 (alternative tracing DB session)
|
||||
public virtual bool LastRecordIsNok { get; set; } /// Not mapped to DB !!! Previous record verification result
|
||||
|
||||
public virtual WaterMeterData WaterMeterData { get; set; }
|
||||
@@ -457,6 +458,7 @@ namespace Results.Entities
|
||||
HydrPruefung = 0;
|
||||
#endif
|
||||
ProcessId = 0;
|
||||
SessionId = 0;
|
||||
LastRecordIsNok = false;
|
||||
}
|
||||
|
||||
@@ -518,6 +520,7 @@ namespace Results.Entities
|
||||
HydrPruefung = src.HydrPruefung;
|
||||
#endif
|
||||
ProcessId = src.ProcessId; /// Not mapped to DB
|
||||
SessionId = src.SessionId; /// Not mapped to DB
|
||||
LastRecordIsNok = src.LastRecordIsNok; /// Not mapped to DB
|
||||
|
||||
foreach (var mtr in MeterTestRslts)
|
||||
@@ -697,6 +700,7 @@ namespace Results.Entities
|
||||
writer.Write(HydrPruefung);
|
||||
#endif
|
||||
writer.Write(ProcessId);
|
||||
writer.Write(SessionId);
|
||||
writer.Write(LastRecordIsNok);
|
||||
|
||||
/// Save WaterMeterData or WaterMeterData.Id
|
||||
@@ -776,6 +780,7 @@ namespace Results.Entities
|
||||
HydrPruefung = reader.ReadInt32();
|
||||
#endif
|
||||
ProcessId = reader.ReadInt32();
|
||||
SessionId = reader.ReadInt32();
|
||||
LastRecordIsNok = reader.ReadBoolean();
|
||||
|
||||
/// Retrieve TestData
|
||||
|
||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.33.2104.0")]
|
||||
[assembly: AssemblyFileVersion("2.33.2104.0")]
|
||||
[assembly: AssemblyVersion("2.33.2084.0")]
|
||||
[assembly: AssemblyFileVersion("2.33.2084.0")]
|
||||
|
||||
Generated
+10
-28
@@ -19,7 +19,7 @@ namespace TBF.Resources {
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Strings {
|
||||
@@ -2274,15 +2274,6 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Get number of cycles to bypass.
|
||||
/// </summary>
|
||||
internal static string Get_number_of_cycles_to_bypass {
|
||||
get {
|
||||
return ResourceManager.GetString("Get_number_of_cycles_to_bypass", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Grab.
|
||||
/// </summary>
|
||||
@@ -5100,15 +5091,6 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Set number of cycles to bypass.
|
||||
/// </summary>
|
||||
internal static string Set_number_of_cycles_to_bypass {
|
||||
get {
|
||||
return ResourceManager.GetString("Set_number_of_cycles_to_bypass", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Set route.
|
||||
/// </summary>
|
||||
@@ -5442,6 +5424,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to .
|
||||
/// </summary>
|
||||
internal static string String1 {
|
||||
get {
|
||||
return ResourceManager.GetString("String1", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Sun.
|
||||
/// </summary>
|
||||
@@ -6282,15 +6273,6 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Unlock a bypass.
|
||||
/// </summary>
|
||||
internal static string Unlock_bypass {
|
||||
get {
|
||||
return ResourceManager.GetString("Unlock_bypass", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Unlock.
|
||||
/// </summary>
|
||||
|
||||
@@ -1683,13 +1683,4 @@
|
||||
<data name="default_printer" xml:space="preserve">
|
||||
<value>předvolená tiskárna</value>
|
||||
</data>
|
||||
<data name="Get_number_of_cycles_to_bypass" xml:space="preserve">
|
||||
<value>Zjisti počet cyklů bez kontroly</value>
|
||||
</data>
|
||||
<data name="Set_number_of_cycles_to_bypass" xml:space="preserve">
|
||||
<value>Nastav počet cyklů bez kontroly</value>
|
||||
</data>
|
||||
<data name="Unlock_bypass" xml:space="preserve">
|
||||
<value>Odemknout vypnutí kontroly</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -2314,16 +2314,4 @@
|
||||
<data name="default_printer" xml:space="preserve">
|
||||
<value>default printer</value>
|
||||
</data>
|
||||
<data name="Get_number_of_cycles_to_bypass" xml:space="preserve">
|
||||
<value>Get number of cycles to bypass</value>
|
||||
</data>
|
||||
<data name="Set_number_of_cycles_to_bypass" xml:space="preserve">
|
||||
<value>Set number of cycles to bypass</value>
|
||||
</data>
|
||||
<data name="Unlock_bypass" xml:space="preserve">
|
||||
<value>Unlock a bypass</value>
|
||||
</data>
|
||||
<data name="Error_reading_configuration_database" xml:space="preserve">
|
||||
<value>Error reading configuration database</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,19 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
|
||||
namespace TBF.Rig
|
||||
{
|
||||
public class DataChangeArgs : EventArgs
|
||||
{
|
||||
public CfgChangeCmd Command;
|
||||
public object Data;
|
||||
|
||||
public DataChangeArgs(CfgChangeCmd command, object data)
|
||||
{
|
||||
Command = command;
|
||||
Data = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-3
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.Rig
|
||||
{
|
||||
@@ -31,8 +31,6 @@ namespace TBF.Rig
|
||||
GetAdc, /// Get regul.valve or diverter ADC
|
||||
GetAdc1, /// Get regul.valve or diverter ADC feedback value #1
|
||||
GetAdc2, /// Get regul.valve or diverter ADC feedback value #2
|
||||
SetData, /// Generic set
|
||||
GetData, /// Generic get
|
||||
}
|
||||
|
||||
public enum ValveCategory
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2018-2023 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
@@ -19,6 +19,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
|
||||
|
||||
public string ConnStr;
|
||||
public string ConnStr2;
|
||||
public string NetAdapter;
|
||||
public bool CheckPreviousRecords;
|
||||
public bool SaveTracingRecords;
|
||||
@@ -29,7 +30,8 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
{
|
||||
ParentName = string.Empty;
|
||||
NetAdapter = string.Empty;
|
||||
ConnStr = "server=10.42.128.35; database=sledovanie2019; uid=sledovanie2019; pwd=velka-javorina-970; charset=utf8;";
|
||||
ConnStr = "server=10.42.128.24; database=sledovanie2020; uid=vyroba2020; pwd=qwerty; charset=utf8;";
|
||||
ConnStr2 = "server=10.42.128.24; database=sledovanie2019; uid=vyroba2019; pwd=qwerty; charset=utf8;";
|
||||
CheckPreviousRecords = true;
|
||||
SaveTracingRecords = true;
|
||||
}
|
||||
@@ -43,11 +45,12 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, CheckPrev={1}, SaveRecords={2}, ConnStr={3}",
|
||||
return string.Format("Name={0}, CheckPrev.={1}, SaveRecords={2}, ConnStr={3}, , ConnStr2={4}",
|
||||
Name,
|
||||
CheckPreviousRecords,
|
||||
SaveTracingRecords,
|
||||
ConnStr);
|
||||
ConnStr,
|
||||
ConnStr2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using log4net;
|
||||
using FluentNHibernate.Cfg;
|
||||
@@ -10,7 +11,9 @@ using FluentNHibernate.Cfg.Db;
|
||||
using NHibernate;
|
||||
using NHibernate.Criterion;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TracingDB.Entities;
|
||||
using Events.Entities;
|
||||
|
||||
namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
{
|
||||
@@ -75,11 +78,17 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
/// </summary>
|
||||
Results.Entities.Batch batch;
|
||||
|
||||
|
||||
ISessionFactory sessionFactory; /// Factory to create database sessions that is initialized in the constructor
|
||||
IList<Process> processes;
|
||||
Dictionary<int, Process> processDictionary;
|
||||
Dictionary<int, IList<Workstep>> workstepsDictionary;
|
||||
|
||||
ISessionFactory sessionFactory2; /// Factory to create database sessions that is initialized in the constructor
|
||||
IList<Process> processes2;
|
||||
Dictionary<int, Process> processDictionary2;
|
||||
Dictionary<int, IList<Workstep>> workstepsDictionary2;
|
||||
|
||||
///
|
||||
/// Previous workstep verification info
|
||||
///
|
||||
@@ -88,9 +97,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
Workstep verifiedWorkstep;
|
||||
Part verifiedPart; /// Applicable when verifyReferencePart == false
|
||||
bool verifyReferencePart;
|
||||
|
||||
int CyclesToSkip;
|
||||
|
||||
|
||||
|
||||
public Tracing() {}
|
||||
|
||||
@@ -120,6 +127,18 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
.SetProperty("hibernate.connection.connect_timeout", Const.MySqlConnectTimeoutSec)
|
||||
.BuildSessionFactory();
|
||||
|
||||
/// Session factory 2 is used to create the 2nd database sessions
|
||||
if (!string.IsNullOrEmpty(tracingCfg.ConnStr2))
|
||||
{
|
||||
sessionFactory2 = Fluently.Configure()
|
||||
.Database(FluentNHibernate.Cfg.Db.MySQLConfiguration.Standard.ConnectionString(tracingCfg.ConnStr2))
|
||||
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<TracingDB.Entities.Process>())
|
||||
.ExposeConfiguration(TracingDB.DB.BuildSchema)
|
||||
.BuildConfiguration()
|
||||
.SetProperty("hibernate.connection.connect_timeout", Const.MySqlConnectTimeoutSec)
|
||||
.BuildSessionFactory();
|
||||
}
|
||||
|
||||
/// Register this test bench in the tracing DB for approx. 2 weeks
|
||||
var session = sessionFactory.OpenSession();
|
||||
#if !DEBUG
|
||||
@@ -136,9 +155,6 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
session.Close();
|
||||
|
||||
TracingDB.DB.SessionFactory = sessionFactory;
|
||||
|
||||
CyclesToSkip = 0;
|
||||
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
else
|
||||
@@ -147,35 +163,6 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
}
|
||||
}
|
||||
|
||||
#region Configuration Change Handling
|
||||
|
||||
public static void OnDataChange(object sender, DataChangeArgs args)
|
||||
{
|
||||
if (DataChangeHandler == null) return;
|
||||
try { DataChangeHandler(sender, args); }
|
||||
catch (Exception e) { log.Error("CfgChangeHandler(...) failed", e); }
|
||||
}
|
||||
|
||||
public static event EventHandler<DataChangeArgs> DataChangeHandler;
|
||||
|
||||
public override void StartChangeHandler()
|
||||
{
|
||||
DataChangeHandler += delegate (object sender, DataChangeArgs args)
|
||||
{
|
||||
var intbox = args.Data as Boxes.IntBox;
|
||||
if (args.Command == CfgChangeCmd.SetData && intbox != null)
|
||||
{
|
||||
CyclesToSkip = intbox.Val;
|
||||
}
|
||||
else if (args.Command == CfgChangeCmd.GetData)
|
||||
{
|
||||
TracingCfgCtrl.OnCmdResponse(this, new CmdResponseArgs(CfgChangeCmd.GetData, 0, CyclesToSkip));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endregion Configuration Change Handling
|
||||
|
||||
///
|
||||
/// IDevice interface implementation
|
||||
///
|
||||
@@ -273,16 +260,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
{
|
||||
log.WarnFormat("{0} : Run() : currentOp = {1}", Name, currentOpState);
|
||||
opCompleted = true;
|
||||
|
||||
if (CyclesToSkip > 0)
|
||||
{
|
||||
CyclesToSkip--;
|
||||
}
|
||||
else if (CheckPreviousRecords(waterMeters) != Retv.OK)
|
||||
{
|
||||
anyError = true;
|
||||
}
|
||||
|
||||
if (CheckPreviousRecords(waterMeters) != Retv.OK) anyError = true;
|
||||
return anyError ? Event.InfoNotRead : Event.InfoRead;
|
||||
}
|
||||
else
|
||||
@@ -381,7 +359,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
|
||||
if ((wm != null) && !wm.Disabled)
|
||||
{
|
||||
CheckPreviousRecordOfSingleWM(session, wm);
|
||||
CheckPreviousRecordOfSingleWM(session, wm, 1);
|
||||
if (wm.LastRecordIsNok)
|
||||
{
|
||||
isAtLeastOneNOK = true;
|
||||
@@ -392,15 +370,34 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
retVal = Retv.OK;
|
||||
}
|
||||
|
||||
if (isAtLeastOneNOK && (sessionFactory2 != null))
|
||||
{
|
||||
using (ISession session2 = sessionFactory2.OpenSession())
|
||||
{
|
||||
for (int i = 0; i < waterMeters.Count; i++)
|
||||
{
|
||||
Results.Entities.WaterMeter wm = waterMeters[i];
|
||||
|
||||
if ((wm != null) && !wm.Disabled && wm.LastRecordIsNok)
|
||||
{
|
||||
CheckPreviousRecordOfSingleWM(session2, wm, 2);
|
||||
}
|
||||
}
|
||||
|
||||
retVal = Retv.OK;
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
Retv CheckPreviousRecordOfSingleWM(ISession session, Results.Entities.WaterMeter wm)
|
||||
Retv CheckPreviousRecordOfSingleWM(ISession session, Results.Entities.WaterMeter wm, int sessionId)
|
||||
{
|
||||
if (string.IsNullOrEmpty(wm.SerialNr))
|
||||
{
|
||||
/// S/N is missing
|
||||
wm.ProcessId = 0;
|
||||
wm.SessionId = 0;
|
||||
wm.LastRecordIsNok = false; /// OK, this is an RFID comm. error, not a production tracing error
|
||||
return Retv.OK;
|
||||
}
|
||||
@@ -434,6 +431,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
{
|
||||
/// No records found
|
||||
wm.ProcessId = 0;
|
||||
wm.SessionId = sessionId;
|
||||
wm.LastRecordIsNok = true; /// NOK
|
||||
///
|
||||
return Retv.OK;
|
||||
@@ -481,6 +479,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
|
||||
|
||||
wm.ProcessId = currentProcess.Id;
|
||||
wm.SessionId = sessionId;
|
||||
wm.LastRecordIsNok = true; /// NOK (=default if no matching record found)
|
||||
foreach (var rcrd in records)
|
||||
{
|
||||
@@ -501,7 +500,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
/// </summary>
|
||||
/// <param name="session">DB session</param>
|
||||
/// <param name="batch">Batch entity</param>
|
||||
public Retv SaveTracingRecords(Results.Entities.Batch batch)
|
||||
Retv SaveTracingRecords(Results.Entities.Batch batch)
|
||||
{
|
||||
ITransaction transaction = null;
|
||||
ISession session = null;
|
||||
@@ -517,7 +516,10 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
int writtenRecordsCount = 0;
|
||||
foreach (var wMtr in batch.WaterMeters)
|
||||
{
|
||||
writtenRecordsCount += SaveSingleWM2DB(session, wMtr);
|
||||
if (wMtr.SessionId == 1)
|
||||
{
|
||||
writtenRecordsCount += SaveSingleWM2DB(session, wMtr);
|
||||
}
|
||||
}
|
||||
transaction.Commit();
|
||||
session.Flush();
|
||||
@@ -543,6 +545,51 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
}
|
||||
}
|
||||
|
||||
if (sessionFactory2 != null)
|
||||
{
|
||||
///
|
||||
/// Save to alternative tracing DB
|
||||
///
|
||||
transaction = null;
|
||||
session = null;
|
||||
try
|
||||
{
|
||||
session = sessionFactory2.OpenSession();
|
||||
transaction = session.BeginTransaction();
|
||||
|
||||
int writtenRecordsCount = 0;
|
||||
foreach (var wMtr in batch.WaterMeters)
|
||||
{
|
||||
if (wMtr.SessionId == 2)
|
||||
{
|
||||
writtenRecordsCount += SaveSingleWM2DB(session, wMtr);
|
||||
}
|
||||
}
|
||||
transaction.Commit();
|
||||
session.Flush();
|
||||
|
||||
log.ErrorFormat("Batch {0}: {1} of {2} watermeters written to the alternative production tracing DB",
|
||||
batch.BatchNr, writtenRecordsCount, batch.WaterMeters.Count);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
if (transaction != null && !transaction.WasCommitted) transaction.Rollback();
|
||||
|
||||
log.WarnFormat("Failed to write results of batch {0} to production tracing DB: {1}",
|
||||
batch.BatchNr, exc.Message);
|
||||
|
||||
return Retv.Error;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (session != null)
|
||||
{
|
||||
session.Close();
|
||||
session.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Retv.OK;
|
||||
}
|
||||
|
||||
@@ -555,12 +602,12 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
/// <returns>Number of written reference record</returns>
|
||||
int SaveSingleWM2DB(ISession session, Results.Entities.WaterMeter wm)
|
||||
{
|
||||
if (string.IsNullOrEmpty(wm.SerialNr))
|
||||
if (string.IsNullOrEmpty(wm.SerialNr) || (wm.ProcessId == 0))
|
||||
{
|
||||
/// Without PCB number there is no DB activity
|
||||
return 0;
|
||||
}
|
||||
else if (wm.ProcessId != 0 && currentProcess != null && wm.ProcessId == currentProcess.Id)
|
||||
else if ((currentProcess != null) && (wm.ProcessId == currentProcess.Id))
|
||||
{
|
||||
/// Process is already loaded => save a reference record for this WM
|
||||
session.SaveOrUpdate(new ReferenceRecord(currentProcess, currentWorkstep, wm.SerialNr, Users.CurrentUser.UserName(), workplace, wm.Passed ? 0 : 1));
|
||||
@@ -592,19 +639,23 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
///
|
||||
|
||||
/// Get all already existing reference records with Code == wm.SerialNr, refRecords[0] will be the most recent one
|
||||
ReadProcessesFromDB(session);
|
||||
IList<ReferenceRecord> refRecords;
|
||||
int trialsCount = 0;
|
||||
do
|
||||
{
|
||||
if (trialsCount > 0) ReadProcessesFromDB(session);
|
||||
|
||||
var refRecords = session.QueryOver<ReferenceRecord>()
|
||||
refRecords = session.QueryOver<ReferenceRecord>()
|
||||
.Where(rr => (rr.Code == wm.SerialNr))
|
||||
.OrderBy(rr => rr.TimeStamp).Desc
|
||||
.List();
|
||||
trialsCount++;
|
||||
}
|
||||
while (refRecords.Count == 0 && trialsCount <= 2);
|
||||
|
||||
/// Save a new reference record from this test bench if workstep "Test_bench" is defined in the obtained WM process
|
||||
IList<Workstep> worksteps;
|
||||
if (refRecords.Count > 0 &&
|
||||
workstepsDictionary.TryGetValue(refRecords[0].Process.Id, out worksteps) &&
|
||||
worksteps != null &&
|
||||
worksteps.Count == 1)
|
||||
if ((refRecords.Count > 0) && workstepsDictionary.TryGetValue(refRecords[0].Process.Id, out worksteps) && (worksteps.Count == 1))
|
||||
{
|
||||
session.SaveOrUpdate(new ReferenceRecord(refRecords[0].Process, worksteps[0], wm.SerialNr, Users.CurrentUser.UserName(), workplace, wm.Passed ? 0 : 1));
|
||||
return 1;
|
||||
|
||||
@@ -1,24 +1,19 @@
|
||||
///
|
||||
/// Copyright (c) 2018-2023 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2018-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Common;
|
||||
using TBF.Resources;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Rig.Elde.Diverter;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
{
|
||||
public partial class TracingCfgCtrl : Configs.ConfigCtrlUtils, IComponentCfgCtrl
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(TracingCfgCtrl));
|
||||
|
||||
public bool ShowMore { get { return false; } }
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
MonitoringCfg config;
|
||||
public IComponentCfg Config
|
||||
@@ -39,30 +34,21 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
private void WriterCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (config == null) return;
|
||||
Localize();
|
||||
Redraw();
|
||||
StartResponseHandler();
|
||||
}
|
||||
}
|
||||
|
||||
public void Closing()
|
||||
public void Closing()
|
||||
{
|
||||
StopResponseHandler();
|
||||
}
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
unlockBypassButton.Text = Strings.Unlock_bypass;
|
||||
setCyclesToBypassButton.Text = Strings.Set_number_of_cycles_to_bypass;
|
||||
getCyclesToBypassButton.Text = Strings.Get_number_of_cycles_to_bypass;
|
||||
}
|
||||
|
||||
void Redraw()
|
||||
void Redraw()
|
||||
{
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
connStrTextBox.Text = config.ConnStr;
|
||||
connStr2TextBox.Text = config.ConnStr2;
|
||||
checkPreviousRecordsCheckBox.Checked = config.CheckPreviousRecords;
|
||||
saveTracingRecordsCheckBox.Checked = config.SaveTracingRecords;
|
||||
|
||||
@@ -118,30 +104,13 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
connStrTextBox.Enabled = true;
|
||||
connStr2TextBox.Enabled = true;
|
||||
netAdapterComboBox.Enabled = true;
|
||||
checkPreviousRecordsCheckBox.Enabled = true;
|
||||
saveTracingRecordsCheckBox.Enabled = true;
|
||||
|
||||
cyclesToBypassTextBox.Enabled = true;
|
||||
setCyclesToBypassButton.Enabled = true;
|
||||
unlockBypassButton.Enabled = false;
|
||||
}
|
||||
|
||||
private void unlockSkipCyclesButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
var reqrdGrpMembership = new GID[] { GID.TraceabilityManagement, GID.HeadOfLab };
|
||||
if (!Users.CurrentUser.IsMemberOf(reqrdGrpMembership))
|
||||
{
|
||||
if (new Users.Forms.LoginDlg(TBF.DB.UserSessionFactories, reqrdGrpMembership, ParentForm).ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
}
|
||||
|
||||
cyclesToBypassTextBox.Enabled = true;
|
||||
setCyclesToBypassButton.Enabled = true;
|
||||
unlockBypassButton.Enabled = false;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
return CfgUpdateFlags.None;
|
||||
}
|
||||
@@ -159,6 +128,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
}
|
||||
|
||||
flags |= UpdateDifferent(ref config.ConnStr, connStrTextBox.Text, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
|
||||
flags |= UpdateDifferent(ref config.ConnStr2, connStr2TextBox.Text, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
|
||||
flags |= UpdateDifferent(ref config.CheckPreviousRecords, checkPreviousRecordsCheckBox.Checked, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
|
||||
flags |= UpdateDifferent(ref config.SaveTracingRecords, saveTracingRecordsCheckBox.Checked, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
|
||||
|
||||
@@ -174,54 +144,5 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
private void setCyclesToSkipButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
int cyclesToSkip = 0;
|
||||
if (!int.TryParse(cyclesToBypassTextBox.Text, out cyclesToSkip) || cyclesToSkip < 0 || cyclesToSkip > 20)
|
||||
{
|
||||
MessageBox.Show(string.Format(Strings.Invalid_0, "(0..20)"));
|
||||
return;
|
||||
}
|
||||
|
||||
Tracing.OnDataChange(this, new DataChangeArgs(CfgChangeCmd.SetData, new IntBox(cyclesToSkip)));
|
||||
}
|
||||
|
||||
private void getCyclesToSkipButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Tracing.OnDataChange(this, new DataChangeArgs(CfgChangeCmd.GetData, null));
|
||||
}
|
||||
|
||||
|
||||
#region Data Change Handling
|
||||
|
||||
public static void OnCmdResponse(object sender, CmdResponseArgs args)
|
||||
{
|
||||
if (CmdResponseHandler == null) return;
|
||||
try { CmdResponseHandler(sender, args); }
|
||||
catch (Exception e) { log.Error("CmdResponseHandler(...) failed", e); }
|
||||
}
|
||||
|
||||
public static event EventHandler<CmdResponseArgs> CmdResponseHandler;
|
||||
|
||||
public void StartResponseHandler()
|
||||
{
|
||||
CmdResponseHandler += DoCmdResponse;
|
||||
}
|
||||
|
||||
public void StopResponseHandler()
|
||||
{
|
||||
CmdResponseHandler -= DoCmdResponse;
|
||||
}
|
||||
|
||||
void DoCmdResponse(object sender, CmdResponseArgs args)
|
||||
{
|
||||
if (args.Command == CfgChangeCmd.GetData)
|
||||
{
|
||||
cyclesToBypassTextBox2.Text = args.Response.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Configuration Change Handling
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+27
-103
@@ -40,15 +40,8 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
this.checkPreviousRecordsCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.netAdapterLabel = new System.Windows.Forms.Label();
|
||||
this.netAdapterComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.cyclesToBypassTextBox = new System.Windows.Forms.TextBox();
|
||||
this.setCyclesToBypassButton = new System.Windows.Forms.Button();
|
||||
this.getCyclesToBypassButton = new System.Windows.Forms.Button();
|
||||
this.cyclesToBypassTextBox2 = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.bypassGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.unlockBypassButton = new System.Windows.Forms.Button();
|
||||
this.bypassGroupBox.SuspendLayout();
|
||||
this.connStr2TextBox = new System.Windows.Forms.TextBox();
|
||||
this.connStr2Label = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
@@ -80,7 +73,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
// connStrTextBox
|
||||
//
|
||||
this.connStrTextBox.Enabled = false;
|
||||
this.connStrTextBox.Location = new System.Drawing.Point(8, 79);
|
||||
this.connStrTextBox.Location = new System.Drawing.Point(8, 74);
|
||||
this.connStrTextBox.Name = "connStrTextBox";
|
||||
this.connStrTextBox.Size = new System.Drawing.Size(435, 20);
|
||||
this.connStrTextBox.TabIndex = 4;
|
||||
@@ -88,7 +81,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
// connStrLabel
|
||||
//
|
||||
this.connStrLabel.AutoSize = true;
|
||||
this.connStrLabel.Location = new System.Drawing.Point(5, 63);
|
||||
this.connStrLabel.Location = new System.Drawing.Point(5, 58);
|
||||
this.connStrLabel.Name = "connStrLabel";
|
||||
this.connStrLabel.Size = new System.Drawing.Size(92, 13);
|
||||
this.connStrLabel.TabIndex = 3;
|
||||
@@ -98,7 +91,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
//
|
||||
this.saveTracingRecordsCheckBox.AutoSize = true;
|
||||
this.saveTracingRecordsCheckBox.Enabled = false;
|
||||
this.saveTracingRecordsCheckBox.Location = new System.Drawing.Point(117, 181);
|
||||
this.saveTracingRecordsCheckBox.Location = new System.Drawing.Point(117, 221);
|
||||
this.saveTracingRecordsCheckBox.Name = "saveTracingRecordsCheckBox";
|
||||
this.saveTracingRecordsCheckBox.Size = new System.Drawing.Size(177, 17);
|
||||
this.saveTracingRecordsCheckBox.TabIndex = 10;
|
||||
@@ -109,7 +102,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
//
|
||||
this.checkPreviousRecordsCheckBox.AutoSize = true;
|
||||
this.checkPreviousRecordsCheckBox.Enabled = false;
|
||||
this.checkPreviousRecordsCheckBox.Location = new System.Drawing.Point(117, 159);
|
||||
this.checkPreviousRecordsCheckBox.Location = new System.Drawing.Point(117, 199);
|
||||
this.checkPreviousRecordsCheckBox.Name = "checkPreviousRecordsCheckBox";
|
||||
this.checkPreviousRecordsCheckBox.Size = new System.Drawing.Size(138, 17);
|
||||
this.checkPreviousRecordsCheckBox.TabIndex = 9;
|
||||
@@ -119,7 +112,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
// netAdapterLabel
|
||||
//
|
||||
this.netAdapterLabel.AutoSize = true;
|
||||
this.netAdapterLabel.Location = new System.Drawing.Point(5, 107);
|
||||
this.netAdapterLabel.Location = new System.Drawing.Point(5, 147);
|
||||
this.netAdapterLabel.Name = "netAdapterLabel";
|
||||
this.netAdapterLabel.Size = new System.Drawing.Size(89, 13);
|
||||
this.netAdapterLabel.TabIndex = 7;
|
||||
@@ -129,95 +122,34 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
//
|
||||
this.netAdapterComboBox.Enabled = false;
|
||||
this.netAdapterComboBox.FormattingEnabled = true;
|
||||
this.netAdapterComboBox.Location = new System.Drawing.Point(8, 123);
|
||||
this.netAdapterComboBox.Location = new System.Drawing.Point(8, 163);
|
||||
this.netAdapterComboBox.Name = "netAdapterComboBox";
|
||||
this.netAdapterComboBox.Size = new System.Drawing.Size(435, 21);
|
||||
this.netAdapterComboBox.TabIndex = 8;
|
||||
//
|
||||
// cyclesToBypassTextBox
|
||||
// connStr2TextBox
|
||||
//
|
||||
this.cyclesToBypassTextBox.Enabled = false;
|
||||
this.cyclesToBypassTextBox.Location = new System.Drawing.Point(41, 25);
|
||||
this.cyclesToBypassTextBox.Name = "cyclesToBypassTextBox";
|
||||
this.cyclesToBypassTextBox.Size = new System.Drawing.Size(50, 20);
|
||||
this.cyclesToBypassTextBox.TabIndex = 11;
|
||||
this.connStr2TextBox.Enabled = false;
|
||||
this.connStr2TextBox.Location = new System.Drawing.Point(8, 118);
|
||||
this.connStr2TextBox.Name = "connStr2TextBox";
|
||||
this.connStr2TextBox.Size = new System.Drawing.Size(434, 20);
|
||||
this.connStr2TextBox.TabIndex = 6;
|
||||
//
|
||||
// setCyclesToBypassButton
|
||||
// connStr2Label
|
||||
//
|
||||
this.setCyclesToBypassButton.Enabled = false;
|
||||
this.setCyclesToBypassButton.Location = new System.Drawing.Point(113, 23);
|
||||
this.setCyclesToBypassButton.Name = "setCyclesToBypassButton";
|
||||
this.setCyclesToBypassButton.Size = new System.Drawing.Size(163, 23);
|
||||
this.setCyclesToBypassButton.TabIndex = 13;
|
||||
this.setCyclesToBypassButton.Text = "Set number of cycles to bypass";
|
||||
this.setCyclesToBypassButton.UseVisualStyleBackColor = true;
|
||||
this.setCyclesToBypassButton.Click += new System.EventHandler(this.setCyclesToSkipButton_Click);
|
||||
//
|
||||
// getCyclesToBypassButton
|
||||
//
|
||||
this.getCyclesToBypassButton.Location = new System.Drawing.Point(41, 59);
|
||||
this.getCyclesToBypassButton.Name = "getCyclesToBypassButton";
|
||||
this.getCyclesToBypassButton.Size = new System.Drawing.Size(163, 23);
|
||||
this.getCyclesToBypassButton.TabIndex = 14;
|
||||
this.getCyclesToBypassButton.Text = "Get number of cycles to bypass";
|
||||
this.getCyclesToBypassButton.UseVisualStyleBackColor = true;
|
||||
this.getCyclesToBypassButton.Click += new System.EventHandler(this.getCyclesToSkipButton_Click);
|
||||
//
|
||||
// cyclesToBypassTextBox2
|
||||
//
|
||||
this.cyclesToBypassTextBox2.Location = new System.Drawing.Point(226, 61);
|
||||
this.cyclesToBypassTextBox2.Name = "cyclesToBypassTextBox2";
|
||||
this.cyclesToBypassTextBox2.Size = new System.Drawing.Size(50, 20);
|
||||
this.cyclesToBypassTextBox2.TabIndex = 15;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(93, 28);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(19, 13);
|
||||
this.label1.TabIndex = 16;
|
||||
this.label1.Text = "-->";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(205, 64);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(19, 13);
|
||||
this.label2.TabIndex = 17;
|
||||
this.label2.Text = "-->";
|
||||
//
|
||||
// bypassGroupBox
|
||||
//
|
||||
this.bypassGroupBox.Controls.Add(this.getCyclesToBypassButton);
|
||||
this.bypassGroupBox.Controls.Add(this.label2);
|
||||
this.bypassGroupBox.Controls.Add(this.cyclesToBypassTextBox);
|
||||
this.bypassGroupBox.Controls.Add(this.label1);
|
||||
this.bypassGroupBox.Controls.Add(this.setCyclesToBypassButton);
|
||||
this.bypassGroupBox.Controls.Add(this.cyclesToBypassTextBox2);
|
||||
this.bypassGroupBox.Location = new System.Drawing.Point(118, 222);
|
||||
this.bypassGroupBox.Name = "bypassGroupBox";
|
||||
this.bypassGroupBox.Size = new System.Drawing.Size(324, 99);
|
||||
this.bypassGroupBox.TabIndex = 18;
|
||||
this.bypassGroupBox.TabStop = false;
|
||||
//
|
||||
// unlockBypassButton
|
||||
//
|
||||
this.unlockBypassButton.Location = new System.Drawing.Point(8, 228);
|
||||
this.unlockBypassButton.Name = "unlockBypassButton";
|
||||
this.unlockBypassButton.Size = new System.Drawing.Size(100, 93);
|
||||
this.unlockBypassButton.TabIndex = 19;
|
||||
this.unlockBypassButton.Text = "Unlock a bypass";
|
||||
this.unlockBypassButton.UseVisualStyleBackColor = true;
|
||||
this.unlockBypassButton.Click += new System.EventHandler(this.unlockSkipCyclesButton_Click);
|
||||
this.connStr2Label.AutoSize = true;
|
||||
this.connStr2Label.Location = new System.Drawing.Point(5, 102);
|
||||
this.connStr2Label.Name = "connStr2Label";
|
||||
this.connStr2Label.Size = new System.Drawing.Size(101, 13);
|
||||
this.connStr2Label.TabIndex = 5;
|
||||
this.connStr2Label.Text = "Connection string 2:";
|
||||
//
|
||||
// TracingCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.unlockBypassButton);
|
||||
this.Controls.Add(this.bypassGroupBox);
|
||||
this.Controls.Add(this.connStr2TextBox);
|
||||
this.Controls.Add(this.connStr2Label);
|
||||
this.Controls.Add(this.netAdapterComboBox);
|
||||
this.Controls.Add(this.netAdapterLabel);
|
||||
this.Controls.Add(this.saveTracingRecordsCheckBox);
|
||||
@@ -228,10 +160,8 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "TracingCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(450, 350);
|
||||
this.Size = new System.Drawing.Size(450, 250);
|
||||
this.Load += new System.EventHandler(this.WriterCfgCtrl_Load);
|
||||
this.bypassGroupBox.ResumeLayout(false);
|
||||
this.bypassGroupBox.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@@ -248,13 +178,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
private System.Windows.Forms.CheckBox checkPreviousRecordsCheckBox;
|
||||
private System.Windows.Forms.Label netAdapterLabel;
|
||||
private System.Windows.Forms.ComboBox netAdapterComboBox;
|
||||
private System.Windows.Forms.TextBox cyclesToBypassTextBox;
|
||||
private System.Windows.Forms.Button setCyclesToBypassButton;
|
||||
private System.Windows.Forms.Button getCyclesToBypassButton;
|
||||
private System.Windows.Forms.TextBox cyclesToBypassTextBox2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.GroupBox bypassGroupBox;
|
||||
private System.Windows.Forms.Button unlockBypassButton;
|
||||
}
|
||||
private System.Windows.Forms.TextBox connStr2TextBox;
|
||||
private System.Windows.Forms.Label connStr2Label;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
return RfidCommands.SetTestMode($"COM{iHead.RfidComPortNr}") ? "OK" : "Error Set Test Mode";
|
||||
}
|
||||
|
||||
#if IPERL
|
||||
internal static string TurnOffRadio(IperlHead iHead)
|
||||
{
|
||||
try
|
||||
@@ -55,7 +54,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
string payload = "03";
|
||||
RfidCommunicationService rfidCommunicationService = new RfidCommunicationService { ComPort = $"COM{iHead.RfidComPortNr}", WaitTimeAfterFailure = 2200, PassThroughWaitTime = 1500, MaxRetries = 3, TimeOut = 5000 };
|
||||
rfidCommunicationService.RfidWrite(Params.u8_WakeUpInterval, payload);
|
||||
return rfidCommunicationService.RfidRead<string>(Params.u8_WakeUpInterval).ToString() == payload ? "OK" : "Error";
|
||||
//return rfidCommunicationService.RfidRead(Params.u8_WakeUpInterval).ToString() == payload? "OK" : "Error";
|
||||
return "OK";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -71,7 +71,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
RfidCommunicationService rfidCommunicationService = new RfidCommunicationService { ComPort = $"COM{iHead.RfidComPortNr}", WaitTimeAfterFailure = 2200, PassThroughWaitTime = 1500, MaxRetries = 3, TimeOut = 5000 };
|
||||
rfidCommunicationService.RfidWrite(SystemInfo.u8_system_state, payload);
|
||||
Thread.Sleep(1000); // must be for pass thru params
|
||||
return rfidCommunicationService.RfidRead<string>(SystemInfo.u8_system_state).ToString() == payload ? "OK" : "Error";
|
||||
//return rfidCommunicationService.RfidRead(SystemInfo.u8_system_state).ToString() == payload ? "OK" : "Error";
|
||||
return "OK";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -89,7 +90,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
{
|
||||
RfidCommunicationService rfidCommunicationService = new RfidCommunicationService { ComPort = $"COM{iHead.RfidComPortNr}", WaitTimeAfterFailure = 2200, PassThroughWaitTime = 1500, MaxRetries = 3, TimeOut = 5000 };
|
||||
//rfidCommunicationService.RfidWrite(Params.u8_Customer_Text, custText);
|
||||
return rfidCommunicationService.RfidRead<string>(Params.u8_Customer_Text).ToString();
|
||||
//return rfidCommunicationService.RfidRead(Params.u8_Customer_Text).ToString();
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -98,6 +100,5 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
}
|
||||
return $"Error COM{iHead.RfidComPortNr}";
|
||||
}
|
||||
#endif /// IPERL
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,7 +341,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
activityLabel.Text = Strings.Optical_heads;
|
||||
ShuffleTextBoxes(ProcessData.WMsCount, ProcessData.LineSize);
|
||||
|
||||
#if IPERL
|
||||
ContextMenu cm = new ContextMenu();
|
||||
cm.MenuItems.Add(NewMenuItem("Read PCB Number" , "ReadPCB"));
|
||||
cm.MenuItems.Add(NewMenuItem("Enter Test Mode" , "StartTestMode"));
|
||||
@@ -354,7 +353,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
cm.MenuItems.Add(NewMenuItem("Open sealing", "OpenSealing"));
|
||||
}
|
||||
this.ContextMenu = cm;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2062,6 +2060,27 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
return CommErr.None; /// No Q2 correction when doing conditional update and WM passed
|
||||
}
|
||||
|
||||
if (q2adjResult.Error < -50 || +50 < q2adjResult.Error ||
|
||||
(q2adjResult2 != null && (q2adjResult2.Error < -50 || +50 < q2adjResult2.Error)))
|
||||
{
|
||||
resultStr = string.Format("Measurement error => no Q2 correction");
|
||||
|
||||
/// At least one of Q2 errors is out of range for Q2 correction
|
||||
log.WarnFormat("OoR => anyhow Q2 correction was done: Pos={0}, PCB#={1}, ***Q2_RL err={2}%***, ***Q2_LR err={3}%***",
|
||||
ihead.Name,
|
||||
ihead.SerialNr,
|
||||
q2adjResult.Error.ToString("F2"),
|
||||
q2adjResult2 != null ? q2adjResult2.Error.ToString("F2") : string.Empty);
|
||||
|
||||
rfidDataLogger.InfoFormat("{0}({1}): Q2 error ({2},{3}) is out of range => Failed",
|
||||
ihead.Name,
|
||||
ihead.SerialNr,
|
||||
q2adjResult.Error.ToString("F2"),
|
||||
q2adjResult2 != null ? q2adjResult2.Error.ToString("F2") : string.Empty);
|
||||
|
||||
return CommErr.Q2OutOfRange;
|
||||
}
|
||||
|
||||
double errLimitLo = test.ErrLimLo + test.Uncertainty;
|
||||
double errLimitHi = test.ErrLimHi - test.Uncertainty;
|
||||
|
||||
@@ -2081,7 +2100,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
/// Do not forget to modify iPerlCommunicationSeq.MakeQ2CorrectedFrom(...)
|
||||
///
|
||||
double errorTarget = (q3error * q2adjResult.Error < 0) ? (0.1 * q2adjResult.Error) : (-0.1 * q2adjResult.Error);
|
||||
q2CorrRL = Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, q2adjResult.Q2CorrRL, q2adjTestData.Qfrom, errorTarget));
|
||||
q2CorrRL = Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, errorTarget, q2adjTestData.Qfrom, q2adjResult.Q2CorrRL));
|
||||
}
|
||||
else if (q2CorrType == Q2CorrType.Dewa ||
|
||||
q2CorrType == Q2CorrType.Dewa_incl_05 ||
|
||||
@@ -2093,7 +2112,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
/// Do not forget to modify iPerlCommunicationSeq.MakeQ2CorrectedFrom(...)
|
||||
///
|
||||
double errorTarget = (q3error * q2adjResult.Error < 0) ? (0.1 * q2adjResult.Error) : (-0.1 * q2adjResult.Error);
|
||||
q2CorrLR = Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, q2adjResult.Q2CorrLR, q2adjTestData.Qfrom, errorTarget));
|
||||
q2CorrLR = Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, errorTarget, q2adjTestData.Qfrom, q2adjResult.Q2CorrLR));
|
||||
}
|
||||
else if (q2CorrType == Q2CorrType.RL ||
|
||||
q2CorrType == Q2CorrType.RL_incl_05 ||
|
||||
@@ -2110,7 +2129,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
return CommErr.None;
|
||||
}
|
||||
|
||||
q2CorrRL = Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, q2adjResult.Q2CorrRL, q2adjTestData.Qfrom));
|
||||
q2CorrRL = Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, 0, q2adjTestData.Qfrom, q2adjResult.Q2CorrRL));
|
||||
}
|
||||
else if (q2CorrType == Q2CorrType.LR ||
|
||||
q2CorrType == Q2CorrType.LR_incl_05 ||
|
||||
@@ -2127,7 +2146,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
return CommErr.None;
|
||||
}
|
||||
|
||||
q2CorrLR = Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, q2adjResult.Q2CorrLR, q2adjTestData.Qfrom));
|
||||
q2CorrLR = Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, 0, q2adjTestData.Qfrom, q2adjResult.Q2CorrLR));
|
||||
}
|
||||
else if (q2CorrType == Q2CorrType.Update || q2CorrType == Q2CorrType.ConditionalUpdate)
|
||||
{
|
||||
@@ -2136,8 +2155,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
/// Assuming the 2nd Q2 tests are done afterwards
|
||||
/// MakeQ2CorrectedFrom(...) is not used
|
||||
///
|
||||
q2CorrRL = Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, q2adjResult.Q2CorrRL, q2adjTestData.Qfrom));
|
||||
q2CorrLR = Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult2, q2adjResult2.Q2CorrLR, q2adjTestData2.Qfrom));
|
||||
q2CorrRL = Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, 0, q2adjTestData.Qfrom, q2adjResult.Q2CorrRL));
|
||||
q2CorrLR = Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult2, 0, q2adjTestData2.Qfrom, q2adjResult2.Q2CorrLR));
|
||||
}
|
||||
else if (q2CorrType == Q2CorrType.Greece || q2CorrType == Q2CorrType.Greece_incl_05 || q2CorrType == Q2CorrType.UpdateBothQ2FactorsTestLRDir)
|
||||
{
|
||||
@@ -2150,7 +2169,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
return CommErr.None;
|
||||
}
|
||||
|
||||
q2CorrLR = Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, q2adjResult.Q2CorrLR, q2adjTestData.Qfrom));
|
||||
q2CorrLR = Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, 0, q2adjTestData.Qfrom, q2adjResult.Q2CorrLR));
|
||||
q2CorrRL = q2CorrLR;
|
||||
}
|
||||
else if (q2CorrType == Q2CorrType.UpdateBothQ2FactorsTestRLDir)
|
||||
@@ -2159,7 +2178,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
/// Another strange process
|
||||
///
|
||||
double errorTarget = (q3error * q2adjResult.Error < 0) ? (0.1 * q2adjResult.Error) : (-0.1 * q2adjResult.Error);
|
||||
q2CorrRL = Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, q2adjResult.Q2CorrRL, q2adjTestData.Qfrom, errorTarget));
|
||||
q2CorrRL = Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, errorTarget, q2adjTestData.Qfrom, q2adjResult.Q2CorrRL));
|
||||
q2CorrLR = q2CorrRL;
|
||||
}
|
||||
|
||||
@@ -2231,7 +2250,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
(q2adjResult.Error < errLimitLo || errLimitHi < q2adjResult.Error ||
|
||||
(q2adjResult2 != null && (q2adjResult2.Error < errLimitLo || errLimitHi < q2adjResult2.Error))))
|
||||
{
|
||||
resultStr += " (OoR)";
|
||||
resultStr = resultStr + " (OoR)";
|
||||
|
||||
/// At least one of Q2 errors is out of range for Q2 correction
|
||||
log.WarnFormat("OoR => anyhow Q2 correction was done: Pos={0}, PCB#={1}, ***Q2_RL err={2}%***, ***Q2_LR err={3}%***, [Lo={4}%, Hi={5}%]",
|
||||
@@ -2779,7 +2798,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
UiBridge.Bridge.OnTestCompleted(this, new UiBridge.TestCompletedEventArgs(string.Empty, null));
|
||||
}
|
||||
|
||||
#if IPERL
|
||||
private MenuItem NewMenuItem(string text, string tag)
|
||||
{
|
||||
MenuItem menuItem = new MenuItem { Text = text, Tag = tag };
|
||||
@@ -2829,7 +2847,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
Application.DoEvents(); // Refresh UI
|
||||
}
|
||||
}
|
||||
#endif /// IPERL
|
||||
|
||||
#region Check boxes edit mode support
|
||||
|
||||
|
||||
@@ -72,7 +72,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
|
||||
/// Get 'wmType' from IperlHead procedure parameters
|
||||
int wmType = 0;
|
||||
#if IPERL
|
||||
foreach (var wm in ProcessData.BatchRslts.Batch.WaterMeters)
|
||||
{
|
||||
if (wm != null && !wm.Disabled && wm.WMTypeId() > 0)
|
||||
@@ -81,7 +80,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (cfg.UseWebService)
|
||||
{
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
/// <param name="nominalFlow">Nominal flow in m3/h</param>
|
||||
/// <param name="currentFactor">0 or the current Q2 correction factor when updating the factor</param>
|
||||
/// <returns>Calculated Q2 correction factor</returns>
|
||||
public double CalculateQ2CorrectionFactor(Results.Entities.MeterTestRslt currentQ2Result, int currentFactor, double nominalFlow, double errorTarget = 0)
|
||||
public double CalculateQ2CorrectionFactor(Results.Entities.MeterTestRslt currentQ2Result, double errorTarget, double nominalFlow, int currentFactor = 0)
|
||||
{
|
||||
double nominalTestFlowLph = Units.ConvertTo(Unit.lph, nominalFlow);
|
||||
double volumeRefShiftedToTarget = currentQ2Result.VolumeRef * (1.0 + errorTarget / 100.0);
|
||||
@@ -226,9 +226,12 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
double F = D / (nominalTestFlowLph * 10.0); /// Error corrected with 8 Raw Units per minute [%]
|
||||
double G = F / B; /// Error corrected with 1 Raw Unit per minute [%]
|
||||
|
||||
/// Do not change the factor for an invalid measurement (q2adjResult.VolumeMeter == 0)
|
||||
double q2CorrectionFactor = (Math.Abs(currentQ2Result.VolumeMeter) <= float.Epsilon) ? Convert.ToDouble(currentFactor) :
|
||||
Convert.ToDouble(currentFactor) - (q2adjErrorShiftedToTarget / G) * (volumeRefShiftedToTarget / currentQ2Result.VolumeMeter);
|
||||
double q2CorrectionFactor = Convert.ToDouble(currentFactor)
|
||||
- (q2adjErrorShiftedToTarget / G) * (volumeRefShiftedToTarget / currentQ2Result.VolumeMeter);
|
||||
|
||||
///// Do not change the factor for an invalid measurement (q2adjResult.VolumeMeter == 0)
|
||||
//double q2CorrectionFactor = (Math.Abs(q2adjResult.VolumeMeter) <= float.Epsilon) ? Convert.ToDouble(currentFactor) :
|
||||
// Convert.ToDouble(currentFactor) - (q2adjResult.Error / G) * (q2adjResult.VolumeRef / q2adjResult.VolumeMeter);
|
||||
|
||||
log.WarnFormat("CalculateQ2CorrectionFactor() : Pos={0}, PCB#={1}, Error={2}%, Target={3}%, Current factor={4} New factor={5}",
|
||||
Name,
|
||||
|
||||
@@ -187,7 +187,6 @@
|
||||
<Compile Include="Rig\Configs\ParamsProvider\ComponentCfgCtrl.designer.cs">
|
||||
<DependentUpon>ComponentCfgCtrl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Rig\DataChangeArgs.cs" />
|
||||
<Compile Include="Rig\DataContainers\BackupAndSecurityOptions\Component.cs" />
|
||||
<Compile Include="Rig\DataContainers\BackupAndSecurityOptions\ComponentCfg.cs" />
|
||||
<Compile Include="Rig\DataContainers\BackupAndSecurityOptions\ComponentFactory.cs" />
|
||||
|
||||
@@ -280,58 +280,51 @@ namespace TBF.UI.ResultsMI
|
||||
{
|
||||
if (b.BatchNr == data.BatchNr)
|
||||
{
|
||||
#if ORACLE_DB
|
||||
if (ProcessData.OracleDB == null)
|
||||
{
|
||||
MessageBox.Show("No database");
|
||||
return;
|
||||
}
|
||||
|
||||
var dlg = new SendAgainDBAndWMSelectionForm();
|
||||
if (dlg.ShowDialog() != DialogResult.OK) return;
|
||||
|
||||
bool isSuccessful = true;
|
||||
#if ORACLE_DB
|
||||
if (dlg.SaveToOracle)
|
||||
OracleConnection conn;
|
||||
switch (dlg.SelectedDB)
|
||||
{
|
||||
if (ProcessData.OracleDB != null)
|
||||
{
|
||||
OracleConnection conn;
|
||||
switch (dlg.SelectedDB)
|
||||
{
|
||||
default:
|
||||
case DBUsed.Production: conn = ProcessData.OracleDB.ProductionDB; break;
|
||||
case DBUsed.Quality: conn = ProcessData.OracleDB.QualityDB; break;
|
||||
case DBUsed.Test: conn = ProcessData.OracleDB.TestDB; break;
|
||||
}
|
||||
|
||||
isSuccessful = isSuccessful && (ProcessData.OracleDB.WriteResultsToDB(conn, b, dlg.SelectedWM, true) == Rig.Output.DB.SensusOracle.Retv.OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
isSuccessful = false;
|
||||
MessageBox.Show("No Oracle database");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (dlg.SaveToProductionTracing)
|
||||
{
|
||||
if (ProcessData.TracingDB != null)
|
||||
{
|
||||
isSuccessful = isSuccessful && (ProcessData.TracingDB.SaveTracingRecords(b) == Rig.Output.DB.ProductionTracing.Retv.OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
isSuccessful = false;
|
||||
MessageBox.Show("No production tracing database");
|
||||
}
|
||||
default:
|
||||
case DBUsed.Production: conn = ProcessData.OracleDB.ProductionDB; break;
|
||||
case DBUsed.Quality: conn = ProcessData.OracleDB.QualityDB; break;
|
||||
case DBUsed.Test: conn = ProcessData.OracleDB.TestDB; break;
|
||||
}
|
||||
|
||||
if (isSuccessful)
|
||||
if (ProcessData.OracleDB.WriteResultsToDB(conn, b, dlg.SelectedWM, true) == Retv.OK)
|
||||
{
|
||||
b.RsltsSent = true; /// Result was successfully sent
|
||||
session.SaveOrUpdate(b); /// Update MySQL DB
|
||||
b.RsltsSent = true; /// Result was successfully sent
|
||||
session.SaveOrUpdate(b); /// Update MySQL DB
|
||||
session.Flush();
|
||||
(sender as PreviousResultCtrl).Sent = true; /// Update UI
|
||||
(sender as PreviousResultCtrl).Sent = true; /// Update UI
|
||||
Redraw();
|
||||
}
|
||||
#elif MUNICH
|
||||
string docVersion = string.Empty;
|
||||
foreach (var cmp in TBF.Rig.StateMachine.Components)
|
||||
{
|
||||
if (cmp.ClassName == "Output.Printers.Munich")
|
||||
{
|
||||
docVersion = (cmp as TBF.Rig.Output.Printers.Munich.Printer).Version;
|
||||
break;
|
||||
}
|
||||
}
|
||||
foreach (var wm in b.WaterMeters)
|
||||
{
|
||||
new Results.Output.Printers.Munich.MunichPrintDocument(docVersion, wm, PageOrientation.Portrait).Print();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public event EventHandler<PreviousResultIdEventArgs> ShowResultsHandler;
|
||||
|
||||
+11
-52
@@ -34,16 +34,12 @@
|
||||
this.waterMetersComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.oracleDbGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.oracleDbCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.productionTracingCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.oracleDbGroupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// databaseComboBox
|
||||
//
|
||||
this.databaseComboBox.FormattingEnabled = true;
|
||||
this.databaseComboBox.Location = new System.Drawing.Point(191, 17);
|
||||
this.databaseComboBox.Location = new System.Drawing.Point(151, 27);
|
||||
this.databaseComboBox.Name = "databaseComboBox";
|
||||
this.databaseComboBox.Size = new System.Drawing.Size(163, 21);
|
||||
this.databaseComboBox.TabIndex = 0;
|
||||
@@ -51,7 +47,7 @@
|
||||
// databaseLabel
|
||||
//
|
||||
this.databaseLabel.AutoSize = true;
|
||||
this.databaseLabel.Location = new System.Drawing.Point(76, 20);
|
||||
this.databaseLabel.Location = new System.Drawing.Point(36, 30);
|
||||
this.databaseLabel.Name = "databaseLabel";
|
||||
this.databaseLabel.Size = new System.Drawing.Size(53, 13);
|
||||
this.databaseLabel.TabIndex = 1;
|
||||
@@ -60,7 +56,7 @@
|
||||
// waterMetersLabel
|
||||
//
|
||||
this.waterMetersLabel.AutoSize = true;
|
||||
this.waterMetersLabel.Location = new System.Drawing.Point(76, 48);
|
||||
this.waterMetersLabel.Location = new System.Drawing.Point(36, 65);
|
||||
this.waterMetersLabel.Name = "waterMetersLabel";
|
||||
this.waterMetersLabel.Size = new System.Drawing.Size(70, 13);
|
||||
this.waterMetersLabel.TabIndex = 2;
|
||||
@@ -69,7 +65,7 @@
|
||||
// waterMetersComboBox
|
||||
//
|
||||
this.waterMetersComboBox.FormattingEnabled = true;
|
||||
this.waterMetersComboBox.Location = new System.Drawing.Point(191, 44);
|
||||
this.waterMetersComboBox.Location = new System.Drawing.Point(151, 62);
|
||||
this.waterMetersComboBox.Name = "waterMetersComboBox";
|
||||
this.waterMetersComboBox.Size = new System.Drawing.Size(163, 21);
|
||||
this.waterMetersComboBox.TabIndex = 3;
|
||||
@@ -77,7 +73,7 @@
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.okButton.Location = new System.Drawing.Point(261, 119);
|
||||
this.okButton.Location = new System.Drawing.Point(106, 115);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(92, 40);
|
||||
this.okButton.TabIndex = 4;
|
||||
@@ -88,7 +84,7 @@
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cancelButton.Location = new System.Drawing.Point(377, 119);
|
||||
this.cancelButton.Location = new System.Drawing.Point(222, 115);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(92, 40);
|
||||
this.cancelButton.TabIndex = 5;
|
||||
@@ -96,54 +92,20 @@
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
|
||||
//
|
||||
// oracleDbGroupBox
|
||||
//
|
||||
this.oracleDbGroupBox.Controls.Add(this.oracleDbCheckBox);
|
||||
this.oracleDbGroupBox.Controls.Add(this.waterMetersComboBox);
|
||||
this.oracleDbGroupBox.Controls.Add(this.databaseComboBox);
|
||||
this.oracleDbGroupBox.Controls.Add(this.databaseLabel);
|
||||
this.oracleDbGroupBox.Controls.Add(this.waterMetersLabel);
|
||||
this.oracleDbGroupBox.Location = new System.Drawing.Point(19, 13);
|
||||
this.oracleDbGroupBox.Name = "oracleDbGroupBox";
|
||||
this.oracleDbGroupBox.Size = new System.Drawing.Size(417, 75);
|
||||
this.oracleDbGroupBox.TabIndex = 6;
|
||||
this.oracleDbGroupBox.TabStop = false;
|
||||
//
|
||||
// oracleDbCheckBox
|
||||
//
|
||||
this.oracleDbCheckBox.AutoSize = true;
|
||||
this.oracleDbCheckBox.Location = new System.Drawing.Point(23, -1);
|
||||
this.oracleDbCheckBox.Name = "oracleDbCheckBox";
|
||||
this.oracleDbCheckBox.Size = new System.Drawing.Size(115, 17);
|
||||
this.oracleDbCheckBox.TabIndex = 7;
|
||||
this.oracleDbCheckBox.Text = "Save to Oracle DB";
|
||||
this.oracleDbCheckBox.UseVisualStyleBackColor = true;
|
||||
this.oracleDbCheckBox.CheckedChanged += new System.EventHandler(this.oracleDbCheckBox_CheckedChanged);
|
||||
//
|
||||
// productionTracingCheckBox
|
||||
//
|
||||
this.productionTracingCheckBox.AutoSize = true;
|
||||
this.productionTracingCheckBox.Location = new System.Drawing.Point(42, 105);
|
||||
this.productionTracingCheckBox.Name = "productionTracingCheckBox";
|
||||
this.productionTracingCheckBox.Size = new System.Drawing.Size(169, 17);
|
||||
this.productionTracingCheckBox.TabIndex = 7;
|
||||
this.productionTracingCheckBox.Text = "Save to production tracing DB";
|
||||
this.productionTracingCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// SendAgainDBAndWMSelectionForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(502, 181);
|
||||
this.Controls.Add(this.productionTracingCheckBox);
|
||||
this.Controls.Add(this.oracleDbGroupBox);
|
||||
this.ClientSize = new System.Drawing.Size(347, 181);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.waterMetersComboBox);
|
||||
this.Controls.Add(this.waterMetersLabel);
|
||||
this.Controls.Add(this.databaseLabel);
|
||||
this.Controls.Add(this.databaseComboBox);
|
||||
this.Name = "SendAgainDBAndWMSelectionForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Database and water meter selection";
|
||||
this.oracleDbGroupBox.ResumeLayout(false);
|
||||
this.oracleDbGroupBox.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@@ -157,8 +119,5 @@
|
||||
private System.Windows.Forms.ComboBox waterMetersComboBox;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
private System.Windows.Forms.GroupBox oracleDbGroupBox;
|
||||
private System.Windows.Forms.CheckBox oracleDbCheckBox;
|
||||
private System.Windows.Forms.CheckBox productionTracingCheckBox;
|
||||
}
|
||||
}
|
||||
@@ -1,28 +1,22 @@
|
||||
///
|
||||
/// Copyright (c) 2021-2023 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using TBF.Rig.Output.DB.SensusOracle;
|
||||
using TBF.Resources;
|
||||
using System.Drawing;
|
||||
|
||||
namespace TBF.UI.ResultsMI
|
||||
{
|
||||
public partial class SendAgainDBAndWMSelectionForm : Form
|
||||
{
|
||||
public bool SaveToOracle;
|
||||
public DBUsed SelectedDB;
|
||||
public WMKind SelectedWM;
|
||||
|
||||
public bool SaveToProductionTracing;
|
||||
|
||||
public SendAgainDBAndWMSelectionForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
ManageCheckGroupBox(oracleDbCheckBox, oracleDbGroupBox);
|
||||
|
||||
Localize();
|
||||
|
||||
databaseComboBox.Items.Add(DBUsed.Production);
|
||||
@@ -46,40 +40,25 @@ namespace TBF.UI.ResultsMI
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool isValid = true;
|
||||
|
||||
SaveToOracle = oracleDbCheckBox.Checked;
|
||||
SaveToProductionTracing = productionTracingCheckBox.Checked;
|
||||
|
||||
if (SaveToOracle)
|
||||
for (DBUsed db = DBUsed.Production; db < DBUsed.Count; db++)
|
||||
{
|
||||
isValid = false;
|
||||
for (DBUsed db = DBUsed.Production; db < DBUsed.Count; db++)
|
||||
if (db.ToString() == databaseComboBox.Text)
|
||||
{
|
||||
if (db.ToString() == databaseComboBox.Text)
|
||||
SelectedDB = db;
|
||||
for (WMKind wm = WMKind.iPERL; wm < WMKind.Count; wm++)
|
||||
{
|
||||
SelectedDB = db;
|
||||
for (WMKind wm = WMKind.iPERL; wm < WMKind.Count; wm++)
|
||||
if (wm.ToString() == waterMetersComboBox.Text)
|
||||
{
|
||||
if (wm.ToString() == waterMetersComboBox.Text)
|
||||
{
|
||||
SelectedWM = wm;
|
||||
isValid = true;
|
||||
}
|
||||
SelectedWM = wm;
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isValid)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Invalid selection");
|
||||
}
|
||||
MessageBox.Show("Invalid selection");
|
||||
}
|
||||
|
||||
private void cancelButton_Click(object sender, EventArgs e)
|
||||
@@ -87,25 +66,5 @@ namespace TBF.UI.ResultsMI
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
|
||||
private void ManageCheckGroupBox(CheckBox chk, GroupBox grp)
|
||||
{
|
||||
/// Make sure the CheckBox isn't in the GroupBox. This will only happen the first time.
|
||||
if (chk.Parent == grp)
|
||||
{
|
||||
grp.Parent.Controls.Add(chk); /// Reparent the CheckBox so it's not in the GroupBox.
|
||||
chk.Location = new Point(chk.Left + grp.Left, chk.Top + grp.Top); /// Adjust the CheckBox's location.
|
||||
chk.BringToFront(); /// Move the CheckBox to the top of the stacking order.
|
||||
}
|
||||
|
||||
/// Enable or disable the GroupBox.
|
||||
grp.Enabled = chk.Checked;
|
||||
}
|
||||
|
||||
private void oracleDbCheckBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
ManageCheckGroupBox(oracleDbCheckBox, oracleDbGroupBox);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user