DataEntry.S620 bug fixes when invoked without an order (after restoring results).

This commit is contained in:
Milan Hanajik
2022-01-06 08:00:06 +01:00
parent 6071d7f598
commit df89050d78
2 changed files with 11 additions and 6 deletions
+2 -2
View File
@@ -178,8 +178,8 @@ namespace TBF.Rig.DataEntry.S620
{ {
if (entryFormCfg.ProductionTracing) if (entryFormCfg.ProductionTracing)
{ {
string order = ProcessData.SelectedProcedure.OrderInfo.POName; string order = (ProcessData.OrderInfo != null) ? ProcessData.OrderInfo.POName : string.Empty;
string workflow = ProcessData.SelectedProcedure.Workflow; string workflow = (ProcessData.Workflow != null) ? ProcessData.Workflow.Name : string.Empty;
myRef.modelessDlg = new FormForMechanicalMetersWithTracing(waterMeters, entryFormCfg.MaxWMsCount, entryFormCfg.CloseButton, true, myRef.modelessDlg = new FormForMechanicalMetersWithTracing(waterMeters, entryFormCfg.MaxWMsCount, entryFormCfg.CloseButton, true,
true, entryFormCfg.OrdersFromProdTracing, order, workflow); true, entryFormCfg.OrdersFromProdTracing, order, workflow);
@@ -414,19 +414,24 @@ namespace TBF.Rig.DataEntry.S620
/// <summary> /// <summary>
/// Assign serial numbers /// Assign serial numbers
/// </summary> /// </summary>
/// <returns>true = s/n-s are assigned, false = order information or DB connection</returns> /// <returns>true = s/n-s are assigned, false = no order information or DB connection</returns>
bool AssignSerialNumbers() bool AssignSerialNumbers()
{ {
assignedSNs.Clear();
var order = ProcessData.OrderInfo; var order = ProcessData.OrderInfo;
///
if (order == null)
{
return false; /// No order information available
}
var oraOrder = order as TBF.Rig.Output.DB.SensusOracle.OrderDetails; var oraOrder = order as TBF.Rig.Output.DB.SensusOracle.OrderDetails;
if (oraOrder != null && (ProcessData.OracleDB == null || !ProcessData.OracleDB.ReadOrderDetails(ref oraOrder))) if (oraOrder != null && (ProcessData.OracleDB == null || !ProcessData.OracleDB.ReadOrderDetails(ref oraOrder)))
{ {
return false; /// Oracle order details could not be loaded return false; /// Oracle order details could not be loaded
} }
assignedSNs.Clear();
lastProducedPcsCount = order.CurrentPcsCount; lastProducedPcsCount = order.CurrentPcsCount;
lastAssignedSN = order.CurrentSN; lastAssignedSN = order.CurrentSN;