Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52806f86b1 | ||
|
|
fb6e6f5a5e | ||
|
|
4aa7c22014 | ||
|
|
f22f25bcb4 | ||
|
|
08f700f5b5 |
@@ -19,7 +19,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;ORACLE_DB</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -29,7 +29,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DefineConstants>TRACE;ORACLE_DB</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;ORACLE_DB</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
@@ -25,7 +25,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DefineConstants>TRACE;ORACLE_DB</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("3.1.1873.0")]
|
||||
[assembly: AssemblyFileVersion("3.1.1873.0")]
|
||||
[assembly: AssemblyVersion("3.1.2063.0")]
|
||||
[assembly: AssemblyFileVersion("3.1.2063.0")]
|
||||
|
||||
@@ -132,49 +132,12 @@ namespace TBF.Rig.DataEntry.S620
|
||||
|
||||
delegate void EntryFormDlgt(EntryForm myRef);
|
||||
///
|
||||
void UpdateOrderWorkflow(out string order, out string workflow)
|
||||
{
|
||||
if (ProcessData.OrderInfo is SharedDatabase.Entities.OrderInfo && ProcessData.TracingDB != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
ISession session = ProcessData.TracingDB.SessionFactory.OpenSession();
|
||||
order = Program.MainWnd.SelectedProcedure.OrderInfo.POName;
|
||||
var list = session.QueryOver<SharedDatabase.Entities.OrderInfo>()
|
||||
.Where(x => (x.POName == Program.MainWnd.SelectedProcedure.OrderInfo.POName))
|
||||
.List();
|
||||
ProcessData.OrderInfo = (list.Count == 1) ? list[0] : null;
|
||||
workflow = (list.Count == 1) ? list[0].Workflow : null;
|
||||
ProcessData.WorkflowSummary = SharedDatabase.WorkflowSummary.ReadFromDB(workflow, "test", session);
|
||||
session.Close();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
order = string.Empty;
|
||||
workflow = string.Empty;
|
||||
ProcessData.OrderInfo = null;
|
||||
ProcessData.WorkflowSummary = null;
|
||||
|
||||
log.ErrorFormat("Unable to load order, workflow or workstep: {0}", exc.Message);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
order = string.Empty;
|
||||
workflow = string.Empty;
|
||||
ProcessData.OrderInfo = null;
|
||||
ProcessData.WorkflowSummary = null;
|
||||
}
|
||||
}
|
||||
///
|
||||
void OnCycleStart(EntryForm myRef)
|
||||
{
|
||||
if (entryFormCfg.ProductionTracing)
|
||||
{
|
||||
string order, workflow;
|
||||
UpdateOrderWorkflow(out order, out workflow);
|
||||
myRef.modelessDlg = new FormForMechanicalMetersWithTracing(waterMeters, entryFormCfg.MaxWMsCount, entryFormCfg.CloseButton, false,
|
||||
true, entryFormCfg.OrdersFromProdTracing, order, workflow);
|
||||
true, entryFormCfg.OrdersFromProdTracing);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -189,10 +152,8 @@ namespace TBF.Rig.DataEntry.S620
|
||||
{
|
||||
if (entryFormCfg.ProductionTracing)
|
||||
{
|
||||
string order, workflow;
|
||||
UpdateOrderWorkflow(out order, out workflow);
|
||||
myRef.modelessDlg = new FormForMechanicalMetersWithTracing(waterMeters, entryFormCfg.MaxWMsCount, entryFormCfg.CloseButton, true,
|
||||
true, entryFormCfg.OrdersFromProdTracing, order, workflow);
|
||||
true, entryFormCfg.OrdersFromProdTracing);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -17,6 +17,8 @@ using SharedDatabase;
|
||||
using SharedDatabase.Entities;
|
||||
using TBF.Rig.Sequences;
|
||||
using TBF.Resources;
|
||||
using NHibernate.Criterion;
|
||||
using Renci.SshNet;
|
||||
|
||||
namespace TBF.Rig.DataEntry.S620
|
||||
{
|
||||
@@ -226,7 +228,7 @@ namespace TBF.Rig.DataEntry.S620
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
||||
public FormForMechanicalMetersWithTracing(IList<Results.Entities.WaterMeter> waterMeters, int maxWMsCount, char closeButton, bool atTheEnd, bool withProductionTracing = true, bool ordersFromProdTracing = false, string purchaseOrder = null, string workflow = null)
|
||||
public FormForMechanicalMetersWithTracing(IList<Results.Entities.WaterMeter> waterMeters, int maxWMsCount, char closeButton, bool atTheEnd, bool withProductionTracing = true, bool ordersFromProdTracing = false)
|
||||
: this()
|
||||
{
|
||||
this.waterMeters = waterMeters;
|
||||
@@ -236,8 +238,6 @@ namespace TBF.Rig.DataEntry.S620
|
||||
this.atTheEnd = atTheEnd;
|
||||
this.withProductionTracing = withProductionTracing;
|
||||
this.ordersFromProdTracing = ordersFromProdTracing;
|
||||
this.preSelectedPurchaseOrder = purchaseOrder;
|
||||
this.preSelectedWorkflow = workflow;
|
||||
|
||||
bodyNrText = new string[waterMeters.Count];
|
||||
assignedSerialNr = new int[waterMeters.Count];
|
||||
@@ -257,11 +257,11 @@ namespace TBF.Rig.DataEntry.S620
|
||||
|
||||
textBoxesCount = Math.Min(textBoxesCount, wmsCount);
|
||||
|
||||
if (SharedDatabase.TracingDB.SessionFactory != null)
|
||||
if (TracingDB.SessionFactory != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
dbSession = SharedDatabase.TracingDB.SessionFactory.OpenSession();
|
||||
dbSession = TracingDB.SessionFactory.OpenSession();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
@@ -270,18 +270,24 @@ namespace TBF.Rig.DataEntry.S620
|
||||
Strings.Error,
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Exclamation);
|
||||
dbSession = null;
|
||||
}
|
||||
|
||||
if (workflows.Count == 0 && dbSession != null)
|
||||
if (dbSession != null)
|
||||
{
|
||||
workflows = ReadReleasedActiveProcesses(dbSession);
|
||||
if (workflows == null)
|
||||
UpdateOrderWorkflow(dbSession, out preSelectedPurchaseOrder, out preSelectedWorkflow);
|
||||
|
||||
if (withProductionTracing && workflows.Count == 0)
|
||||
{
|
||||
MessageBox.Show(Strings.Reading_from_the_production_tracing_DB_failed,
|
||||
Strings.Error,
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Exclamation);
|
||||
workflows = new List<Process>();
|
||||
workflows = ReadReleasedActiveProcesses(dbSession);
|
||||
if (workflows == null)
|
||||
{
|
||||
MessageBox.Show(Strings.Reading_from_the_production_tracing_DB_failed,
|
||||
Strings.Error,
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Exclamation);
|
||||
workflows = new List<Process>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -412,6 +418,43 @@ namespace TBF.Rig.DataEntry.S620
|
||||
//clearButton.Text = Strings.ClearBtnText;
|
||||
}
|
||||
|
||||
void UpdateOrderWorkflow(ISession session, out string orderName, out string workflowName)
|
||||
{
|
||||
if (ProcessData.OrderInfo is OrderInfo && ProcessData.TracingDB != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
orderName = Program.MainWnd.SelectedProcedure.OrderInfo.POName;
|
||||
var list = session.QueryOver<OrderInfo>()
|
||||
.Where(x => (x.POName == Program.MainWnd.SelectedProcedure.OrderInfo.POName))
|
||||
.List();
|
||||
ProcessData.OrderInfo = (list.Count == 1) ? list[0] : null;
|
||||
workflowName = (list.Count == 1) ? list[0].Workflow : null;
|
||||
ProcessData.WorkflowSummary = WorkflowSummary.ReadFromDB(workflowName, "test", session);
|
||||
|
||||
log.WarnFormat("Pre-selected order={0}, pre-selected workflow={1}",
|
||||
(ProcessData.OrderInfo != null) ? ProcessData.OrderInfo.POName : "<none>",
|
||||
!string.IsNullOrEmpty(workflowName) ? workflowName : "<none>");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
orderName = string.Empty;
|
||||
workflowName = string.Empty;
|
||||
ProcessData.OrderInfo = null;
|
||||
ProcessData.WorkflowSummary = null;
|
||||
|
||||
log.ErrorFormat("Unable to load order, workflow or workstep: {0}", exc.Message);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
orderName = string.Empty;
|
||||
workflowName = string.Empty;
|
||||
ProcessData.OrderInfo = null;
|
||||
ProcessData.WorkflowSummary = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Assign serial numbers
|
||||
/// </summary>assigned, false = no order information or DB connection</returns>
|
||||
@@ -812,10 +855,36 @@ namespace TBF.Rig.DataEntry.S620
|
||||
{
|
||||
ProcessData.OrderInfo.CurrentPcsCount = lastProducedPcsCount;
|
||||
ProcessData.OrderInfo.CurrentSN = lastAssignedSN;
|
||||
|
||||
if (ProcessData.OrderInfo is OrderInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
dbSession.SaveOrUpdate(ProcessData.OrderInfo as OrderInfo);
|
||||
dbSession.Flush();
|
||||
|
||||
log.WarnFormat("Order={0} CurrentPcsCount={1} CurrentSN={2} CurrentRA={3}",
|
||||
ProcessData.OrderInfo.POName, ProcessData.OrderInfo.CurrentPcsCount,
|
||||
ProcessData.OrderInfo.CurrentSN, ProcessData.OrderInfo.CurrentRA);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.ErrorFormat("Failed to update OrderInfo.CurrentSN... : {0}", ex.Message);
|
||||
}
|
||||
}
|
||||
else if (ProcessData.OrderInfo is Output.DB.SensusOracle.OrderDetails)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
if (atTheEnd && withProductionTracing)
|
||||
{
|
||||
//SaveProductionTracingRecords(); /// TODO
|
||||
//dbSession.Flush();
|
||||
}
|
||||
|
||||
//SaveProductionTracingRecords(); /// TODO
|
||||
if (atTheEnd) UiBridge.Bridge.OnTestCompleted(this, new UiBridge.TestCompletedEventArgs(string.Empty, null));
|
||||
|
||||
completed = true;
|
||||
Close();
|
||||
@@ -826,52 +895,49 @@ namespace TBF.Rig.DataEntry.S620
|
||||
/// </summary>
|
||||
private void SaveProductionTracingRecords()
|
||||
{
|
||||
if (atTheEnd)
|
||||
///
|
||||
/// Save records to MySQL
|
||||
///
|
||||
string workplace = TBF.Rig.Sequences.ProcessData.BenchInfo.TestBenchName;
|
||||
ITransaction mysqlTransaction = dbSession.BeginTransaction();
|
||||
try
|
||||
{
|
||||
///
|
||||
/// Save records to MySQL
|
||||
///
|
||||
string workplace = TBF.Rig.Sequences.ProcessData.BenchInfo.TestBenchName;
|
||||
ITransaction mysqlTransaction = dbSession.BeginTransaction();
|
||||
try
|
||||
for (int wmNr0 = 0; wmNr0 < textBoxesCount; wmNr0++)
|
||||
{
|
||||
for (int wmNr0 = 0; wmNr0 < textBoxesCount; wmNr0++)
|
||||
bool passed = waterMeters[wmNr0].Passed;
|
||||
|
||||
if (passed && !string.IsNullOrEmpty(bodyNrBoxes[wmNr0].Text) && !string.IsNullOrEmpty(serialNrBoxes[wmNr0].Text))
|
||||
{
|
||||
bool passed = waterMeters[wmNr0].Passed;
|
||||
/////
|
||||
///// Prepare records
|
||||
/////
|
||||
//ReferenceRecord refRecord = new ReferenceRecord(currentOrder,
|
||||
// currentWorkflow,
|
||||
// currentWStep,
|
||||
// bodyNrBoxes[wmNr0].Text,
|
||||
// GlobalData.GetCurrentUserName(),
|
||||
// workplace,
|
||||
// passed ? 1 : 0);
|
||||
//if (uniqueCodeParts.Count >= 2)
|
||||
//{
|
||||
// refRecord.Records.Add(new Record(uniqueCodeParts[1], refRecord, serialNrBoxes[wmNr0].Text));
|
||||
//}
|
||||
|
||||
if (passed && !string.IsNullOrEmpty(bodyNrBoxes[wmNr0].Text) && !string.IsNullOrEmpty(serialNrBoxes[wmNr0].Text))
|
||||
{
|
||||
/////
|
||||
///// Prepare records
|
||||
/////
|
||||
//ReferenceRecord refRecord = new ReferenceRecord(currentOrder,
|
||||
// currentWorkflow,
|
||||
// currentWStep,
|
||||
// bodyNrBoxes[wmNr0].Text,
|
||||
// GlobalData.GetCurrentUserName(),
|
||||
// workplace,
|
||||
// passed ? 1 : 0);
|
||||
//if (uniqueCodeParts.Count >= 2)
|
||||
//{
|
||||
// refRecord.Records.Add(new Record(uniqueCodeParts[1], refRecord, serialNrBoxes[wmNr0].Text));
|
||||
//}
|
||||
//for (int i = 0; i < palety.Count; i++)
|
||||
//{
|
||||
// refRecord.Records.Add(new Record(palety[i].Part, refRecord, palety[i].ScannedCode));
|
||||
//}
|
||||
|
||||
//for (int i = 0; i < palety.Count; i++)
|
||||
//{
|
||||
// refRecord.Records.Add(new Record(palety[i].Part, refRecord, palety[i].ScannedCode));
|
||||
//}
|
||||
|
||||
//TracingDB.SaveRecords(dbSession, refRecord);
|
||||
}
|
||||
//TracingDB.SaveRecords(dbSession, refRecord);
|
||||
}
|
||||
}
|
||||
|
||||
mysqlTransaction.Commit();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
log.ErrorFormat("MySQL database transaction rolled back, data not comitted: {0}", exc.Message);
|
||||
mysqlTransaction.Rollback();
|
||||
}
|
||||
mysqlTransaction.Commit();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
log.ErrorFormat("MySQL database transaction rolled back, data not comitted: {0}", exc.Message);
|
||||
mysqlTransaction.Rollback();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1656,10 +1722,11 @@ namespace TBF.Rig.DataEntry.S620
|
||||
{
|
||||
Program.LocalSettings.LastWStep = currentWStep.Name;
|
||||
}
|
||||
|
||||
Program.LocalSettings.Save();
|
||||
|
||||
//wplaceRegistration.UnregisterWorkplace(dbSession);
|
||||
if (dbSession != null && dbSession.IsOpen)
|
||||
{
|
||||
dbSession.Close();
|
||||
}
|
||||
}
|
||||
|
||||
#region Color flash and beep
|
||||
|
||||
@@ -488,27 +488,6 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
session = SessionFactory.OpenSession();
|
||||
transaction = session.BeginTransaction();
|
||||
|
||||
var reloadedOrder = session.QueryOver<OrderInfo>()
|
||||
.Where(x => x.POName == order.POName)
|
||||
.List();
|
||||
if (reloadedOrder.Count == 1)
|
||||
{
|
||||
reloadedOrder[0].CurrentPcsCount = order.CurrentPcsCount;
|
||||
reloadedOrder[0].CurrentSN = order.CurrentSN;
|
||||
reloadedOrder[0].CurrentRA = order.CurrentRA;
|
||||
if (order.CurrentPcsCount > 0)
|
||||
{
|
||||
reloadedOrder[0].POState = (sbyte)OrderState.Active;
|
||||
}
|
||||
session.SaveOrUpdate(reloadedOrder[0]);
|
||||
log.WarnFormat("Order={0} CurrentPcsCount={1} CurrentSN={2} CurrentRA={3}",
|
||||
order.POName, order.CurrentPcsCount, order.CurrentSN, order.CurrentRA);
|
||||
}
|
||||
else
|
||||
{
|
||||
log.ErrorFormat("Unexpected reloadedOrder.Count == {0} in SaveTracingRecords()", reloadedOrder.Count);
|
||||
}
|
||||
|
||||
string workplace = (ProcessData.BenchInfo != null) ? ProcessData.BenchInfo.TestBenchName : "TestBench";
|
||||
int writtenRecordsCount = 0;
|
||||
foreach (var wm in batch.WaterMeters)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -9,10 +9,8 @@ using log4net;
|
||||
using NHibernate;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using Results.Entities;
|
||||
using TBF.Rig.Operations;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Boxes;
|
||||
using TBF.Resources;
|
||||
using TBF.UiBridge;
|
||||
|
||||
@@ -417,7 +415,7 @@ namespace TBF.Rig.Sequences
|
||||
|
||||
for (int i = 0; i < BatchRslts.Batch.WaterMeters.Count; i++)
|
||||
{
|
||||
WaterMeter wm = BatchRslts.Batch.WaterMeters[i];
|
||||
var wm = BatchRslts.Batch.WaterMeters[i];
|
||||
if (wm != null && !wm.Disabled)
|
||||
{
|
||||
if (wm.Passed)
|
||||
@@ -646,7 +644,7 @@ namespace TBF.Rig.Sequences
|
||||
/// Restore and fix a batch - part 2
|
||||
for (int i = 0; i < BatchRslts.Batch.WaterMeters.Count; i++)
|
||||
{
|
||||
WaterMeter wm = BatchRslts.Batch.WaterMeters[i];
|
||||
var wm = BatchRslts.Batch.WaterMeters[i];
|
||||
if (wm != null && !wm.Disabled)
|
||||
{
|
||||
/// Water meter did not pass
|
||||
@@ -1231,6 +1229,8 @@ namespace TBF.Rig.Sequences
|
||||
///
|
||||
BatchRslts.Batch.EndTime = DateTime.Now; /// Set cycle end time
|
||||
Results.Utils.GetCounterStates(BatchRslts.Batch, Program.LocalSettings.Counters); /// Update counters
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(string.Empty, null));
|
||||
|
||||
/// Remove results of internal tests
|
||||
for (int i = BatchRslts.Batch.TestRslts.Count - 1; i >= 0; i--)
|
||||
{
|
||||
@@ -1238,7 +1238,7 @@ namespace TBF.Rig.Sequences
|
||||
{
|
||||
for (int j = wm.MeterTestRslts.Count - 1; j >= 0; j--)
|
||||
{
|
||||
MeterTestRslt mtr = wm.MeterTestRslts[j];
|
||||
var mtr = wm.MeterTestRslts[j];
|
||||
if ((mtr.Publish() == Publish.Never || mtr.Publish() == Publish.Internal) && !mtr.Evaluate())
|
||||
{
|
||||
wm.MeterTestRslts.RemoveAt(j);
|
||||
@@ -1246,7 +1246,7 @@ namespace TBF.Rig.Sequences
|
||||
}
|
||||
}
|
||||
|
||||
TestRslt tr = BatchRslts.Batch.TestRslts[i];
|
||||
var tr = BatchRslts.Batch.TestRslts[i];
|
||||
if ((tr.Publish() == Publish.Never || tr.Publish() == Publish.Internal) && !tr.Evaluate())
|
||||
{
|
||||
BatchRslts.Batch.TestRslts.RemoveAt(i);
|
||||
@@ -1256,7 +1256,7 @@ namespace TBF.Rig.Sequences
|
||||
/// (1) Set boolean WaterMeter.Passed variable, (2) Remove disabled water meters
|
||||
for (int wmNr0 = ProcessData.BatchRslts.Batch.WaterMeters.Count - 1; wmNr0 >= 0; wmNr0--)
|
||||
{
|
||||
WaterMeter wm = ProcessData.BatchRslts.Batch.WaterMeters[wmNr0];
|
||||
var wm = ProcessData.BatchRslts.Batch.WaterMeters[wmNr0];
|
||||
if (wm.Disabled)
|
||||
{
|
||||
/// Do not save disabled watermeters to DB, remove them from the list
|
||||
|
||||
@@ -450,8 +450,8 @@ namespace TBF.Rig.TestMethods.S640Communication
|
||||
progressBar1.Value = 0;
|
||||
}
|
||||
|
||||
TBF.UiBridge.TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 10, 0, 140, 0, 0, 0 });
|
||||
TBF.UiBridge.Bridge.OnTestProgress(null, new TBF.UiBridge.TestProgressEventArgs(tests[acIx], Progress.JustStarted));
|
||||
UiBridge.TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 10, 0, 140, 0, 0, 0 });
|
||||
UiBridge.Bridge.OnTestProgress(null, new TBF.UiBridge.TestProgressEventArgs(tests[acIx], Progress.JustStarted));
|
||||
|
||||
sirtDataLogger.InfoFormat(""); /// Makes the log more readable when there is a lot of data
|
||||
sirtDataLogger.WarnFormat("Activity = {0}", activities[acIx]);
|
||||
@@ -739,6 +739,48 @@ namespace TBF.Rig.TestMethods.S640Communication
|
||||
{
|
||||
activityLabel.Text = "SIRT communication in progress";
|
||||
|
||||
if (ProcessData.OrderInfo is OrderInfo && ProcessData.TracingDB != null)
|
||||
{
|
||||
var order = ProcessData.OrderInfo as OrderInfo;
|
||||
ISession session = null;
|
||||
try
|
||||
{
|
||||
session = ProcessData.TracingDB.SessionFactory.OpenSession();
|
||||
var orders = session.QueryOver<OrderInfo>()
|
||||
.Where(x => x.POName == order.POName)
|
||||
.List();
|
||||
if (orders.Count == 1)
|
||||
{
|
||||
orders[0].CurrentPcsCount = ProcessData.OrderInfo.CurrentPcsCount;
|
||||
orders[0].CurrentSN = ProcessData.OrderInfo.CurrentSN;
|
||||
orders[0].CurrentRA = ProcessData.OrderInfo.CurrentRA;
|
||||
session.SaveOrUpdate(orders[0]);
|
||||
session.Flush();
|
||||
|
||||
log.WarnFormat("Order={0} CurrentPcsCount={1} CurrentSN={2} CurrentRA={3}",
|
||||
ProcessData.OrderInfo.POName, ProcessData.OrderInfo.CurrentPcsCount,
|
||||
ProcessData.OrderInfo.CurrentSN, ProcessData.OrderInfo.CurrentRA);
|
||||
}
|
||||
else
|
||||
{
|
||||
log.Error("Failed to update OrderInfo.CurrentSN...");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.ErrorFormat("Failed to update OrderInfo.CurrentSN... : {0}", ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (session != null && session.IsOpen) session.Close();
|
||||
}
|
||||
}
|
||||
else if (ProcessData.OrderInfo is Output.DB.SensusOracle.OrderDetails && ProcessData.OracleDB != null)
|
||||
{
|
||||
int updatedCount = ProcessData.OracleDB
|
||||
.UpdateOrderDetails(ProcessData.OrderInfo as Output.DB.SensusOracle.OrderDetails);
|
||||
}
|
||||
|
||||
log.DebugFormat("Saving '{0}' file", EndFileName);
|
||||
if (debugLevel == DebugMode.Normal)
|
||||
{
|
||||
@@ -755,12 +797,6 @@ namespace TBF.Rig.TestMethods.S640Communication
|
||||
progressBar1.Maximum = Math.Max(fileExchangeTimeout, 1);
|
||||
progressBar1.Value = 0;
|
||||
|
||||
if (ProcessData.OracleDB != null && ProcessData.OrderInfo is TBF.Rig.Output.DB.SensusOracle.OrderDetails)
|
||||
{
|
||||
int updatedCount = ProcessData.OracleDB
|
||||
.UpdateOrderDetails(ProcessData.OrderInfo as TBF.Rig.Output.DB.SensusOracle.OrderDetails);
|
||||
}
|
||||
|
||||
step = Step.AwaitResponseToEndePro;
|
||||
}
|
||||
///--------------------------------------------------------------------------
|
||||
@@ -922,10 +958,12 @@ namespace TBF.Rig.TestMethods.S640Communication
|
||||
/// </summary>
|
||||
/// <param name="waterMeters"></param>
|
||||
/// <param name="optoHeads"></param>
|
||||
/// <returns>true = s/n-s are assigned, false = order information or DB connection</returns>
|
||||
/// <returns>true = s/n-s are assigned, false = missing order information or DB connection</returns>
|
||||
bool AssignNewSNsAndRadioAddresses(IList<Results.Entities.WaterMeter> waterMeters, RegisterReaders.S640Stream.S640Stream[] optoHeads)
|
||||
{
|
||||
var order = ProcessData.OrderInfo;
|
||||
if (order == null) return false;
|
||||
|
||||
var oraOrder = order as TBF.Rig.Output.DB.SensusOracle.OrderDetails;
|
||||
///
|
||||
if (oraOrder != null && (ProcessData.OracleDB == null || !ProcessData.OracleDB.ReadOrderDetails(ref oraOrder)))
|
||||
@@ -1000,6 +1038,8 @@ namespace TBF.Rig.TestMethods.S640Communication
|
||||
}
|
||||
}
|
||||
|
||||
UiBridge.Bridge.OnTestCompleted(this, new UiBridge.TestCompletedEventArgs(string.Empty, null));
|
||||
|
||||
areNewSNsAndRadioAddressesAssigned = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
+4
-4
@@ -39,7 +39,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;MANAGED;ORACLE_DB; TURA_IPERL</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
@@ -50,7 +50,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DefineConstants>TRACE;MANAGED;ORACLE_DB; TURA_IPERL</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -60,7 +60,7 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;MANAGED;ORACLE_DB; TURA_IPERL</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
@@ -70,7 +70,7 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DefineConstants>TRACE;MANAGED;ORACLE_DB; TURA_IPERL</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
|
||||
@@ -618,8 +618,9 @@ namespace TBF.UI.Process
|
||||
|
||||
void OnTestCompleted(object sender, TestCompletedEventArgs args)
|
||||
{
|
||||
if (ProcessData.RegisterReaders == null || ProcessData.BatchRslts == null ||
|
||||
ProcessData.BatchRslts.Batch == null || ProcessData.BatchRslts.Batch.WaterMeters == null)
|
||||
if (args.TestRslt == null || ProcessData.RegisterReaders == null || ProcessData.BatchRslts == null
|
||||
|| ProcessData.BatchRslts.Batch == null
|
||||
|| ProcessData.BatchRslts.Batch.WaterMeters == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user