DataEntry.S620 : Purchase order re-read before starting form,at the end of the cycle, ver. 3.1.1873
This commit is contained in:
parent
3c59cd1bee
commit
938da3ac62
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("3.1.1872.0")]
|
||||
[assembly: AssemblyFileVersion("3.1.1872.0")]
|
||||
[assembly: AssemblyVersion("3.1.1873.0")]
|
||||
[assembly: AssemblyFileVersion("3.1.1873.0")]
|
||||
|
||||
@ -131,45 +131,48 @@ 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;
|
||||
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 orderInfo = ProcessData.TracingDB.ReReadOneOrder(order, session);
|
||||
ProcessData.OrderInfo = orderInfo;
|
||||
workflow = (orderInfo != null) ? orderInfo.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;
|
||||
}
|
||||
|
||||
string order, workflow;
|
||||
UpdateOrderWorkflow(out order, out workflow);
|
||||
myRef.modelessDlg = new FormForMechanicalMetersWithTracing(waterMeters, entryFormCfg.MaxWMsCount, entryFormCfg.CloseButton, false,
|
||||
true, entryFormCfg.OrdersFromProdTracing, order, workflow);
|
||||
}
|
||||
@ -178,6 +181,7 @@ namespace TBF.Rig.DataEntry.S620
|
||||
ProcessData.WorkflowSummary = null;
|
||||
myRef.modelessDlg = new FormForMechanicalMeters(waterMeters, entryFormCfg.MaxWMsCount, entryFormCfg.CloseButton, false, false);
|
||||
}
|
||||
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
@ -185,9 +189,8 @@ namespace TBF.Rig.DataEntry.S620
|
||||
{
|
||||
if (entryFormCfg.ProductionTracing)
|
||||
{
|
||||
string order = (ProcessData.OrderInfo != null) ? ProcessData.OrderInfo.POName : string.Empty;
|
||||
string workflow = (ProcessData.WorkflowSummary != null) ? ProcessData.WorkflowSummary.Workflow.Name : string.Empty;
|
||||
|
||||
string order, workflow;
|
||||
UpdateOrderWorkflow(out order, out workflow);
|
||||
myRef.modelessDlg = new FormForMechanicalMetersWithTracing(waterMeters, entryFormCfg.MaxWMsCount, entryFormCfg.CloseButton, true,
|
||||
true, entryFormCfg.OrdersFromProdTracing, order, workflow);
|
||||
}
|
||||
@ -195,6 +198,7 @@ namespace TBF.Rig.DataEntry.S620
|
||||
{
|
||||
myRef.modelessDlg = new FormForMechanicalMeters(waterMeters, entryFormCfg.MaxWMsCount, entryFormCfg.CloseButton, true, false);
|
||||
}
|
||||
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2020-2021 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2020-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -82,7 +82,6 @@ namespace TBF.Rig.DataEntry.S620
|
||||
/// Production tracing - part that persists between different forms (production cycles)
|
||||
///
|
||||
static IList<Process> workflows; /// Workflows from the database
|
||||
static OrderInfo currentOrder;
|
||||
static Process currentWorkflow; /// Currently used workflow
|
||||
static Workstep currentWStep; /// Currently used workflow step
|
||||
static IList<Workstep> stepsOfTheCurrentWorkflow;
|
||||
@ -415,9 +414,9 @@ namespace TBF.Rig.DataEntry.S620
|
||||
|
||||
/// <summary>
|
||||
/// Assign serial numbers
|
||||
/// </summary>
|
||||
/// <returns>true = s/n-s are assigned, false = no order information or DB connection</returns>
|
||||
/// </summary>assigned, false = no order information or DB connection</returns>
|
||||
bool AssignSerialNumbers()
|
||||
/// <returns>true = s/n-s are
|
||||
{
|
||||
var order = ProcessData.OrderInfo;
|
||||
|
||||
@ -426,8 +425,6 @@ namespace TBF.Rig.DataEntry.S620
|
||||
return false; /// No order information available
|
||||
}
|
||||
|
||||
|
||||
|
||||
var oraOrder = order as TBF.Rig.Output.DB.SensusOracle.OrderDetails;
|
||||
if (oraOrder != null && (ProcessData.OracleDB == null || !ProcessData.OracleDB.ReadOrderDetails(ref oraOrder)))
|
||||
{
|
||||
@ -1427,7 +1424,7 @@ namespace TBF.Rig.DataEntry.S620
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string msg = string.Format("ERROR: ORACLE DB query select AUFTRAGSNUMMER, SOLLSTUECK from VT_AUFTRAG_PD where ... failed: {0}", exc.Message);
|
||||
string msg = string.Format("ERROR: Reading order nr. {0} from tracing DB failed: {1}", orderNr, exc.Message);
|
||||
log.Error(msg);
|
||||
System.Diagnostics.Debug.WriteLine(msg);
|
||||
firstSN = 0;
|
||||
|
||||
@ -238,9 +238,11 @@ namespace TBF.Rig.DataEntry.iPerl
|
||||
{
|
||||
ISession session = ProcessData.TracingDB.SessionFactory.OpenSession();
|
||||
string poName = Program.MainWnd.SelectedProcedure.OrderInfo.POName;
|
||||
var orderInfo = ProcessData.TracingDB.ReReadOneOrder(poName, session);
|
||||
ProcessData.OrderInfo = orderInfo;
|
||||
string workflow = (orderInfo != null) ? orderInfo.Workflow : null;
|
||||
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;
|
||||
string workflow = (list.Count == 1) ? list[0].Workflow : null;
|
||||
ProcessData.WorkflowSummary = SharedDatabase.WorkflowSummary.ReadFromDB(workflow, "test", session);
|
||||
session.Close();
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
|
||||
var result = session.QueryOver<OrderInfo>()
|
||||
.Where(x => (x.POState == (sbyte)OrderState.New || x.POState == (sbyte)OrderState.Active))
|
||||
.List<OrderInfo>();
|
||||
.List();
|
||||
|
||||
if (openAndCloseSession) session.Close();
|
||||
|
||||
@ -190,7 +190,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
}
|
||||
}
|
||||
|
||||
public OrderInfo ReReadOneOrder(string poName, ISession session = null)
|
||||
public OrderInfo ReadOrder(string poName, ISession session = null)
|
||||
{
|
||||
bool openAndCloseSession = (session == null) || !session.IsOpen;
|
||||
|
||||
@ -208,7 +208,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
log.ErrorFormat("Cannot re-read order {0} from the tracing DB: {1}", poName, exc.Message);
|
||||
log.ErrorFormat("Cannot read order {0} from the tracing DB: {1}", poName, exc.Message);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,15 +223,17 @@ namespace TBF.Rig.Sequences
|
||||
try
|
||||
{
|
||||
ISession session = ProcessData.TracingDB.SessionFactory.OpenSession();
|
||||
string poName = Program.MainWnd.SelectedProcedure.OrderInfo.POName;
|
||||
var orderInfo = ProcessData.TracingDB.ReReadOneOrder(poName, session);
|
||||
ProcessData.OrderInfo = orderInfo;
|
||||
string workflow = orderInfo != null ? orderInfo.Workflow : null;
|
||||
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;
|
||||
string workflow = (list.Count == 1) ? list[0].Workflow : null;
|
||||
ProcessData.WorkflowSummary = SharedDatabase.WorkflowSummary.ReadFromDB(workflow, "test", session);
|
||||
session.Close();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
ProcessData.OrderInfo = null;
|
||||
ProcessData.WorkflowSummary = null;
|
||||
log.ErrorFormat("Unable to load order, workflow or workstep: {0}", exc.Message);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user