DataEntry.iPerl bug fixes when invoked without the production tracing, ver. 3.1.1846

This commit is contained in:
Milan Hanajik
2022-01-06 08:00:07 +01:00
parent df89050d78
commit 4d018a8ba8
3 changed files with 16 additions and 10 deletions
+2 -2
View File
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.1.1845.0")]
[assembly: AssemblyFileVersion("3.1.1845.0")]
[assembly: AssemblyVersion("3.1.1846.0")]
[assembly: AssemblyFileVersion("3.1.1846.0")]
@@ -78,11 +78,11 @@ namespace TBF.Rig.DataEntry.iPerl
foreach (var o in list) listOfOrders.Add(o);
}
if ((cfg.Orders == Orders.FromTracingDB || cfg.Orders == Orders.CombinedAndFromTracingDB) && ProcessData.TracingDB != null)
if ((cfg.Orders == Orders.FromTracingDB || cfg.Orders == Orders.CombinedAndFromTracingDB) &&
ProcessData.TracingDB != null &&
ProcessData.TracingDB.DebugLevel == DebugMode.Normal)
{
ISession session = ProcessData.TracingDB.SessionFactory.OpenSession();
var list = ProcessData.TracingDB.ReadOrders(session);
if (session.IsOpen) session.Close();
var list = ProcessData.TracingDB.ReadOrders();
foreach (var o in list) listOfOrders.Add(o);
}
+10 -4
View File
@@ -240,14 +240,20 @@ namespace TBF.Rig.Output.DB.ProductionTracing
return null;
}
public IList<OrderInfo> ReadOrders(ISession session)
public IList<OrderInfo> ReadOrders(ISession session = null)
{
bool openAndCloseSession = (session == null) || !session.IsOpen;
try
{
session = SessionFactory.OpenSession();
if (openAndCloseSession) session = SessionFactory.OpenSession();
var result = session.QueryOver<OrderInfo>()
.Where(x => (x.POState == (sbyte)OrderState.New || x.POState == (sbyte)OrderState.Active))
.List<OrderInfo>();
if (openAndCloseSession) session.Close();
return result;
}
catch (Exception exc)
@@ -266,8 +272,8 @@ namespace TBF.Rig.Output.DB.ProductionTracing
if (openAndCloseSession) session = SessionFactory.OpenSession();
var list = session.QueryOver<OrderInfo>()
.Where(x => (x.Id == order.Id))
.List();
.Where(x => (x.Id == order.Id))
.List();
if (openAndCloseSession) session.Close();