diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs index 1c3e8f2f0..276b419d1 100644 --- a/TBF/Properties/AssemblyInfo.cs +++ b/TBF/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("3.1.1867.0")] -[assembly: AssemblyFileVersion("3.1.1867.0")] +[assembly: AssemblyVersion("3.1.1872.0")] +[assembly: AssemblyFileVersion("3.1.1872.0")] diff --git a/TBF/Rig/DataEntry/S620/FormForMechanicalMetersWithTracing.cs b/TBF/Rig/DataEntry/S620/FormForMechanicalMetersWithTracing.cs index 68e1172f3..3947c1aa5 100644 --- a/TBF/Rig/DataEntry/S620/FormForMechanicalMetersWithTracing.cs +++ b/TBF/Rig/DataEntry/S620/FormForMechanicalMetersWithTracing.cs @@ -66,6 +66,8 @@ namespace TBF.Rig.DataEntry.S620 int firstSN; /// First serial number int snDigits; /// Number of digits of the middle part of the serial number int pcsCount; /// Pieces count + int currentPcsCount; + int currentSN; IList foundMeters; IList foundSNs; @@ -260,7 +262,7 @@ namespace TBF.Rig.DataEntry.S620 { try { - dbSession = SharedDatabase.TracingDB.CreateSession(TBF.DB.CurrentBench.EventsDBSettings.ConnectionString); + dbSession = SharedDatabase.TracingDB.SessionFactory.OpenSession(); } catch (Exception exc) { @@ -424,6 +426,8 @@ 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))) { @@ -435,6 +439,8 @@ namespace TBF.Rig.DataEntry.S620 lastProducedPcsCount = order.CurrentPcsCount; lastAssignedSN = order.CurrentSN; + log.WarnFormat("currentSN={0} currentPcsCount={1}", order.CurrentSN, order.CurrentPcsCount); + for (int i = 0; i < textBoxesCount; i++) { bool passed = waterMeters[i].PassedFromTests(); @@ -446,6 +452,8 @@ namespace TBF.Rig.DataEntry.S620 serialNrBoxes[i].Text = currentSerialNr.ToString(string.Format("D{0}", snDigits)); + log.WarnFormat(" WMNr={0} BodyNr={1} s/n={2}", i+1, bodyNrBoxes[i].Text, serialNrBoxes[i].Text); + lastAssignedSN = currentSerialNr; lastProducedPcsCount++; } @@ -455,6 +463,8 @@ namespace TBF.Rig.DataEntry.S620 } } + log.WarnFormat("lastAssignedSN={0} lastProducedPcsCount={1}", lastAssignedSN, lastProducedPcsCount); + Invalidate(rect); return true; @@ -738,8 +748,9 @@ namespace TBF.Rig.DataEntry.S620 foreach (var order in list) orderCB.Items.Add(order.POName); } } - catch + catch (Exception exc) { + log.ErrorFormat("Reading orders from tracing DB failed: {0}", exc.Message); } if (preSelectedPurchaseOrder != null) @@ -1357,6 +1368,8 @@ namespace TBF.Rig.DataEntry.S620 snDigits = 0; prefix = null; suffix = null; + currentPcsCount = 0; + currentSN = 0; #if false firstSN = 101; @@ -1392,7 +1405,7 @@ namespace TBF.Rig.DataEntry.S620 if (listOfOrders.Count != 1) { - string msg2 = string.Format("No PO={0} found in Oracle DB", orderNr); + string msg2 = string.Format("No PO={0} found in tracing DB", orderNr); log.Warn(msg2); System.Diagnostics.Debug.WriteLine(msg2); return false; @@ -1403,39 +1416,13 @@ namespace TBF.Rig.DataEntry.S620 prefix = listOfOrders[0].SNPrefix; snDigits = listOfOrders[0].SNDigitsCount; suffix = listOfOrders[0].SNSuffix; + currentPcsCount = listOfOrders[0].CurrentPcsCount; + currentSN = listOfOrders[0].CurrentSN; - foundMeters.Clear(); - - //OracleCommand cmd2 = new OracleCommand("SELECT vt_fernum, zaehlernummer, hydr_pruefung FROM vt_zaehler_pd" + - // " WHERE anbid=:1 AND auftragsnummer=:2 ORDER BY zaehlernummer ASC", connection); - - //cmd2.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = ProcessData.OracleDB.Anbid_Producer }); ///:1 - //cmd2.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = orderNr }); ///:2 - - //OracleDataReader dr2 = cmd2.ExecuteReader(); - //while (dr2.Read()) - //{ - // string bodyNr = dr2.GetString(0); /// Body number - // int serialNr = dr2.GetInt32(1); /// Assigned serial number when OK, 0 when NOK - // int result = dr2.GetInt32(2); /// HYDR_PRUEFUNG: 96=OK, 224=OK after a repetition, 97=NOK - - // if (serialNr > 0 && result != 97) - // { - // foundMeters.Add(new BodySerNrResult(bodyNr, serialNr, result)); - // } - //} - //dr2.Close(); - - string msg = string.Format("PO={0} found in Oracle DB: first S/N={1}, total pieces count={2}, pieces produced so far={3}", orderNr, firstSN, piecesCount, foundMeters.Count); + string msg = string.Format("PO={0} found in tracing DB: first S/N={1}, total pieces count={2}, pieces produced so far={3}", orderNr, firstSN, piecesCount, currentPcsCount); log.Warn(msg); System.Diagnostics.Debug.WriteLine(msg); - foundSNs.Clear(); - foreach (var mtr in foundMeters) - { - if (mtr.SerialNr > 0) foundSNs.Add(mtr.SerialNr); - } - return true; } catch (Exception exc) diff --git a/TBF/UI/MainWnd.cs b/TBF/UI/MainWnd.cs index bb50ae141..52cbf3a2b 100644 --- a/TBF/UI/MainWnd.cs +++ b/TBF/UI/MainWnd.cs @@ -809,10 +809,11 @@ namespace TBF.UI { try { - tracingDBOrders = SharedDatabase.TracingDB.CreateSession(TBF.DB.CurrentBench.EventsDBSettings.ConnectionString) - .QueryOver() - .Where(x => x.POState != (sbyte)SharedDatabase.Entities.OrderState.Finished) - .List(); + var session = TBF.Rig.Sequences.ProcessData.TracingDB.SessionFactory.OpenSession(); + tracingDBOrders = session.QueryOver() + .Where(x => x.POState != (sbyte)SharedDatabase.Entities.OrderState.Finished) + .List(); + session.Close(); } catch {