diff --git a/TBF/Rig/DataEntry/S620/EntryForm.cs b/TBF/Rig/DataEntry/S620/EntryForm.cs
index 370888f66..f818120c3 100644
--- a/TBF/Rig/DataEntry/S620/EntryForm.cs
+++ b/TBF/Rig/DataEntry/S620/EntryForm.cs
@@ -178,8 +178,8 @@ namespace TBF.Rig.DataEntry.S620
{
if (entryFormCfg.ProductionTracing)
{
- string order = ProcessData.SelectedProcedure.OrderInfo.POName;
- string workflow = ProcessData.SelectedProcedure.Workflow;
+ string order = (ProcessData.OrderInfo != null) ? ProcessData.OrderInfo.POName : string.Empty;
+ string workflow = (ProcessData.Workflow != null) ? ProcessData.Workflow.Name : string.Empty;
myRef.modelessDlg = new FormForMechanicalMetersWithTracing(waterMeters, entryFormCfg.MaxWMsCount, entryFormCfg.CloseButton, true,
true, entryFormCfg.OrdersFromProdTracing, order, workflow);
diff --git a/TBF/Rig/DataEntry/S620/FormForMechanicalMetersWithTracing.cs b/TBF/Rig/DataEntry/S620/FormForMechanicalMetersWithTracing.cs
index 654816924..804c58ed3 100644
--- a/TBF/Rig/DataEntry/S620/FormForMechanicalMetersWithTracing.cs
+++ b/TBF/Rig/DataEntry/S620/FormForMechanicalMetersWithTracing.cs
@@ -414,19 +414,24 @@ namespace TBF.Rig.DataEntry.S620
///
/// Assign serial numbers
///
- /// true = s/n-s are assigned, false = order information or DB connection
+ /// true = s/n-s are assigned, false = no order information or DB connection
bool AssignSerialNumbers()
{
- assignedSNs.Clear();
-
var order = ProcessData.OrderInfo;
- ///
+
+ if (order == null)
+ {
+ 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)))
{
return false; /// Oracle order details could not be loaded
}
+ assignedSNs.Clear();
+
lastProducedPcsCount = order.CurrentPcsCount;
lastAssignedSN = order.CurrentSN;