From df89050d7831d35458157a2b4ee8544734215006 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Wed, 5 Jan 2022 12:29:39 +0100 Subject: [PATCH] DataEntry.S620 bug fixes when invoked without an order (after restoring results). --- TBF/Rig/DataEntry/S620/EntryForm.cs | 4 ++-- .../S620/FormForMechanicalMetersWithTracing.cs | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) 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;