diff --git a/TBF/BenchControl/Events.cs b/TBF/BenchControl/Events.cs
index d8a74ccd0..dd5e48f32 100644
--- a/TBF/BenchControl/Events.cs
+++ b/TBF/BenchControl/Events.cs
@@ -106,6 +106,7 @@ namespace TBF.BenchControl
/// CheckUi events
UiCmdReloadBatch,
+ UiCmdReloadAndFixBatch,
UiCmdStartTest,
UiCmdStartQ1,
UiCmdStartQ2,
diff --git a/TBF/BenchControl/Operations/CheckUIOp.cs b/TBF/BenchControl/Operations/CheckUIOp.cs
index f651de58d..24e0f508d 100644
--- a/TBF/BenchControl/Operations/CheckUIOp.cs
+++ b/TBF/BenchControl/Operations/CheckUIOp.cs
@@ -85,6 +85,7 @@ namespace TBF.BenchControl.Operations
{
/// Bench Control Panel buttons
case UI2BenchCmd.ReloadBatch: return Event.UiCmdReloadBatch;
+ case UI2BenchCmd.ReloadAndFixBatch: return Event.UiCmdReloadAndFixBatch;
case UI2BenchCmd.StartTest: return Event.UiCmdStartTest;
case UI2BenchCmd.StartQ1: return Event.UiCmdStartQ1;
case UI2BenchCmd.StartQ2: return Event.UiCmdStartQ2;
diff --git a/TBF/BenchControl/Output/DB/ProductionTracing/Tracing.cs b/TBF/BenchControl/Output/DB/ProductionTracing/Tracing.cs
index e89b3d701..c965df6f3 100644
--- a/TBF/BenchControl/Output/DB/ProductionTracing/Tracing.cs
+++ b/TBF/BenchControl/Output/DB/ProductionTracing/Tracing.cs
@@ -278,6 +278,14 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
Retv CheckPreviousRecordOfSingleWM(ISession session, Results.Entities.WaterMeter wm)
{
+ if (string.IsNullOrEmpty(wm.SerialNr))
+ {
+ wm.ProcessId = 0;
+ wm.IsLastRecordOk = true;
+ return Retv.OK;
+ }
+
+
///
/// Get all already existing reference records with Code == wm.SerialNr, refRecords[0] will be the most recent one
///
@@ -429,7 +437,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
/// Number of written reference record
int SaveSingleWM2DB(ISession session, Results.Entities.WaterMeter wm)
{
- if (string.IsNullOrEmpty(wm.SerialNr))
+ if (string.IsNullOrEmpty(wm.SerialNr) || (wm.ProcessId == 0))
{
/// Without PCB number there is no DB activity
return 0;
diff --git a/TBF/BenchControl/Sequences/MainSeq.cs b/TBF/BenchControl/Sequences/MainSeq.cs
index fd2ebba03..bf949b1a9 100644
--- a/TBF/BenchControl/Sequences/MainSeq.cs
+++ b/TBF/BenchControl/Sequences/MainSeq.cs
@@ -495,6 +495,38 @@ namespace TBF.BenchControl.Sequences
BatchRslts = CreateNewBatchResults(newBatchNr, StateMachine.Procedure);
RestoreBatchResults(TBF.UiBridge.Bridge.BatchNr, ref BatchRslts); /// pass the original batch number of the batch to be restored
}
+ else if (selection == Selection.RestoreAndFixBatch)
+ {
+ BatchRslts = CreateNewBatchResults(newBatchNr, StateMachine.Procedure);
+ RestoreBatchResults(TBF.UiBridge.Bridge.BatchNr, ref BatchRslts); /// pass the original batch number of the batch to be restored
+
+ ///
+ /// Fix "Previous workstep is missing" error in this batch
+ ///
+ for (int i = 0; i < BatchRslts.WaterMeters.Length; i++)
+ {
+ WaterMeter wm = BatchRslts.WaterMeters[i];
+ if (wm != null)
+ {
+ if (wm.Passed)
+ {
+ wm.Disabled = true;
+ }
+ else if (!wm.Disabled)
+ {
+ wm.ErrorFlags = wm.ErrorFlags & (~(int)ErrorFlagMask.E28);
+ foreach (var mtr in wm.MeterTestRslts)
+ {
+ if (mtr.TestData().Evaluate && (mtr.TestData().Name == "Kontrola montaze") && (mtr.TestData().Method == "iPerlCommunication"))
+ {
+ mtr.TestDone = true;
+ mtr.Passed = true;
+ }
+ }
+ }
+ }
+ }
+ }
else
{
BatchRslts = CreateNewBatchResults(newBatchNr, StateMachine.Procedure);
@@ -508,7 +540,7 @@ namespace TBF.BenchControl.Sequences
///
/// Display 'Cycle Begin Form' in case of a normal batch (not a restored batch)
///
- if ((selection != Selection.RestoreBatch) && !OpenCycleBeginForm())
+ if ((selection != Selection.RestoreBatch) && (selection != Selection.RestoreAndFixBatch) && !OpenCycleBeginForm())
{
goto stop;
}
@@ -553,7 +585,7 @@ namespace TBF.BenchControl.Sequences
{
goto assume_bench_filled;
}
- else if ((selection == Selection.Cycle && benchFilled) || (selection == Selection.RestoreBatch))
+ else if ((selection == Selection.Cycle && benchFilled) || (selection == Selection.RestoreBatch) || (selection == Selection.RestoreAndFixBatch))
{
///
/// Always ask a question in case of a restored batch
@@ -639,7 +671,7 @@ namespace TBF.BenchControl.Sequences
benchFilled = true;
Bridge.Bench2UI(ButtonsEtc.ShowBenchFilled);
- if ((selection == Selection.Cycle) || (selection == Selection.RestoreBatch))
+ if ((selection == Selection.Cycle) || (selection == Selection.RestoreBatch) || (selection == Selection.RestoreAndFixBatch))
{
///
/// Read start info from the DB @ cycle start
@@ -668,7 +700,7 @@ namespace TBF.BenchControl.Sequences
}
}
- if ((selection != Selection.PurgeBegin) && (selection != Selection.RestoreBatch))
+ if ((selection != Selection.PurgeBegin) && (selection != Selection.RestoreBatch) && (selection != Selection.RestoreAndFixBatch))
{
goto cycle_or_test_selected;
}
@@ -1338,21 +1370,22 @@ namespace TBF.BenchControl.Sequences
///
/// Return values of MakeSelection()
///
- public enum Selection
- {
- PurgeBegin,
- PurgeEnd,
- Break,
- Cycle,
- RestOfCycle,
- Test,
- Q1,
- Q2,
- Q3,
- SaveResults,
- RestoreBatch,
+ public enum Selection
+ {
+ PurgeBegin,
+ PurgeEnd,
+ Break,
+ Cycle,
+ RestOfCycle,
+ Test,
+ Q1,
+ Q2,
+ Q3,
+ SaveResults,
+ RestoreBatch,
+ RestoreAndFixBatch,
Shutdown,
- }
+ }
///
@@ -1443,6 +1476,7 @@ namespace TBF.BenchControl.Sequences
if (e.Contains(Event.UiCmdStartQ3)) return Selection.Q3;
if (e.Contains(Event.UiCmdAcceptResults)) return Selection.SaveResults;
if (e.Contains(Event.UiCmdReloadBatch)) return Selection.RestoreBatch;
+ if (e.Contains(Event.UiCmdReloadAndFixBatch)) return Selection.RestoreAndFixBatch;
}
while (true);
diff --git a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationSeq.cs b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationSeq.cs
index 98bf02541..c06087d5a 100644
--- a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationSeq.cs
+++ b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationSeq.cs
@@ -143,15 +143,15 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
}
#endif
#if TURA_SPECIAL
- if (arg.ToLower() == "q2factors")
- {
- if ((wm.ProdQ2CorrRL != wm.Q2CorrRL) || (wm.ProdQ2CorrLR != wm.Q2CorrLR))
+ if (arg.ToLower() == "q2factors")
{
- anyErrorOfThisMeter = true;
- message += string.Format("Q2 korekčné faktory vodomera {0} nesedia{1}", wm.WMPosition, Environment.NewLine);
- errorIndicators |= (int)ErrorFlagMask.E26; /// Q2 correction factors not valid
+ if ((wm.ProdQ2CorrRL != wm.Q2CorrRL) || (wm.ProdQ2CorrLR != wm.Q2CorrLR))
+ {
+ anyErrorOfThisMeter = true;
+ message += string.Format("Q2 korekčné faktory vodomera {0} nesedia{1}", wm.WMPosition, Environment.NewLine);
+ errorIndicators |= (int)ErrorFlagMask.E26; /// Q2 correction factors not valid
+ }
}
- }
#endif
if (arg.ToLower() == "direction")
{
diff --git a/TBF/Forms/PreviousResultCtrl.Designer.cs b/TBF/Forms/PreviousResultCtrl.Designer.cs
index fbf37af2e..7d48e08f7 100644
--- a/TBF/Forms/PreviousResultCtrl.Designer.cs
+++ b/TBF/Forms/PreviousResultCtrl.Designer.cs
@@ -49,7 +49,7 @@
this.sendReloadButton.TabIndex = 15;
this.sendReloadButton.Text = "Again";
this.sendReloadButton.UseVisualStyleBackColor = true;
- this.sendReloadButton.Click += new System.EventHandler(this.sendReloadButton_Click);
+ this.sendReloadButton.MouseClick += new System.Windows.Forms.MouseEventHandler(this.sendReloadButton_MouseClick);
//
// sentCheckBox
//
diff --git a/TBF/Forms/PreviousResultCtrl.cs b/TBF/Forms/PreviousResultCtrl.cs
index ec7642900..931a9ff5e 100644
--- a/TBF/Forms/PreviousResultCtrl.cs
+++ b/TBF/Forms/PreviousResultCtrl.cs
@@ -10,7 +10,7 @@ namespace TBF.Forms
public partial class PreviousResultCtrl : UserControl
{
readonly PreviousResultsDlg parent;
- readonly bool reloadEn;
+ readonly PreviousResultsMode mode;
public int BatchNr;
public DateTime StarTime;
@@ -27,11 +27,11 @@ namespace TBF.Forms
InitializeComponent();
}
- public PreviousResultCtrl(PreviousResultsDlg parent, int bnr, DateTime s, DateTime e, string ver, string proc, string pOrd, int passCnt, int failCnt, bool sent, bool reloadEn)
+ public PreviousResultCtrl(PreviousResultsDlg parent, int bnr, DateTime s, DateTime e, string ver, string proc, string pOrd, int passCnt, int failCnt, bool sent, PreviousResultsMode mode)
: this()
{
this.parent = parent;
- this.reloadEn = reloadEn;
+ this.mode = mode;
BatchNr = bnr;
StarTime = s;
@@ -60,8 +60,13 @@ namespace TBF.Forms
#elif ORACLE_DB
sentCheckBox.Text = Strings.Sent;
sentCheckBox.Checked = Sent;
- sendReloadButton.Enabled = reloadEn || !Sent;
- sendReloadButton.Text = reloadEn ? Strings.Restore : Strings.Save_again;
+ sendReloadButton.Enabled = (mode != PreviousResultsMode.Show) || !Sent;
+ switch (mode)
+ {
+ case PreviousResultsMode.Show: sendReloadButton.Text = Strings.Save_again; break;
+ case PreviousResultsMode.Reload: sendReloadButton.Text = Strings.Restore; break;
+ case PreviousResultsMode.Fix: sendReloadButton.Text = Strings.Fix; break;
+ }
#else
sentCheckBox.Visible = false;
sendReloadButton.Enabled = reloadEn;
@@ -83,17 +88,33 @@ namespace TBF.Forms
#endif
}
- private void sendReloadButton_Click(object sender, EventArgs e)
- {
- if (reloadEn)
- parent.OnReload(this, new PreviousResultIdEventArgs(BatchNr));
- else
- parent.OnSendAgain(this, new PreviousResultIdEventArgs(BatchNr));
- }
-
private void showButton_Click(object sender, EventArgs e)
{
parent.OnShowResults(this, new PreviousResultIdEventArgs(BatchNr));
}
+
+ private void sendReloadButton_MouseClick(object sender, MouseEventArgs e)
+ {
+ if (mode == PreviousResultsMode.Show)
+ {
+ parent.OnSendAgain(this, new PreviousResultIdEventArgs(BatchNr));
+ }
+ else if (mode == PreviousResultsMode.Reload)
+ {
+ parent.OnReload(this, new PreviousResultIdEventArgs(BatchNr));
+ }
+ else if (mode == PreviousResultsMode.Fix)
+ {
+ /// Access only to thise who manage production tracing
+ Users.Grp.GID[] rqrdGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.TraceabilityManagement };
+
+ if ((new Users.Forms.LoginDlg(Users.GlobalData.CurrentUser.UserName, rqrdGroupMembership)).ShowDialog() != DialogResult.OK)
+ {
+ return;
+ }
+
+ parent.OnReloadAndFix(this, new PreviousResultIdEventArgs(BatchNr));
+ }
+ }
}
}
diff --git a/TBF/Forms/PreviousResultsDlg.cs b/TBF/Forms/PreviousResultsDlg.cs
index 76ef5465c..4640def63 100644
--- a/TBF/Forms/PreviousResultsDlg.cs
+++ b/TBF/Forms/PreviousResultsDlg.cs
@@ -13,6 +13,13 @@ using Oracle.DataAccess.Client;
namespace TBF.Forms
{
+ public enum PreviousResultsMode
+ {
+ Show,
+ Reload,
+ Fix,
+ }
+
public partial class PreviousResultsDlg : Form
{
static readonly ILog log = LogManager.GetLogger(typeof(PreviousResultsDlg));
@@ -22,13 +29,13 @@ namespace TBF.Forms
int lastDisplayedBatchNr;
const int LinesCount = 25;
IList batches;
- bool reloadEn;
+ PreviousResultsMode mode;
- public PreviousResultsDlg(bool reloadEn)
+ public PreviousResultsDlg(PreviousResultsMode mode)
{
InitializeComponent();
- this.reloadEn = reloadEn;
+ this.mode = mode;
currentBatchNr = Program.LocalSettings.BatchNr;
SendAgainHandler += delegate(object sndr, PreviousResultIdEventArgs args)
@@ -45,7 +52,7 @@ namespace TBF.Forms
}
public PreviousResultsDlg()
- : this(false)
+ : this(PreviousResultsMode.Show)
{
}
@@ -90,6 +97,25 @@ namespace TBF.Forms
}
+ public void OnReloadAndFix(object sender, PreviousResultIdEventArgs data)
+ {
+ foreach (var batch in batches)
+ {
+ if (batch.BatchNr == data.BatchNr)
+ {
+ TBF.UiBridge.Bridge.BatchNr = batch.BatchNr;
+
+ Program.MainWnd.ReloadProcedureComboBoxItems(batch.ProcedureName);
+ TBF.UiBridge.Bridge.Ui2Bench(TBF.UiBridge.UI2BenchCmd.ReloadAndFixBatch);
+ break;
+ }
+ }
+
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+
+
public event EventHandler SendAgainHandler;
@@ -291,7 +317,7 @@ namespace TBF.Forms
passedCount,
failedCount,
b.RsltsSent,
- reloadEn));
+ mode));
}
ResumeLayout();
diff --git a/TBF/Resources/Strings.Designer.cs b/TBF/Resources/Strings.Designer.cs
index ee03ec078..f8884bf71 100644
--- a/TBF/Resources/Strings.Designer.cs
+++ b/TBF/Resources/Strings.Designer.cs
@@ -1752,6 +1752,15 @@ namespace TBF.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Fix.
+ ///
+ internal static string Fix {
+ get {
+ return ResourceManager.GetString("Fix", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Flow.
///
diff --git a/TBF/Resources/Strings.cs.resx b/TBF/Resources/Strings.cs.resx
index 39b50f65b..2e3766630 100644
--- a/TBF/Resources/Strings.cs.resx
+++ b/TBF/Resources/Strings.cs.resx
@@ -1434,4 +1434,7 @@
Krátké impulsy
+
+ Oprav
+
\ No newline at end of file
diff --git a/TBF/Resources/Strings.resx b/TBF/Resources/Strings.resx
index 7dc952c6b..572ef7709 100644
--- a/TBF/Resources/Strings.resx
+++ b/TBF/Resources/Strings.resx
@@ -1981,4 +1981,7 @@
Short pulses
+
+ Fix
+
\ No newline at end of file
diff --git a/TBF/Screens/ResultsTabPageCtrl.Designer.cs b/TBF/Screens/ResultsTabPageCtrl.Designer.cs
index 537ff880a..8d8eba0fa 100644
--- a/TBF/Screens/ResultsTabPageCtrl.Designer.cs
+++ b/TBF/Screens/ResultsTabPageCtrl.Designer.cs
@@ -32,6 +32,7 @@ namespace TBF.Screens
private void InitializeComponent()
{
this.splitContainer = new System.Windows.Forms.SplitContainer();
+ this.fixPreviousResultsButton = new System.Windows.Forms.Button();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
@@ -70,6 +71,7 @@ namespace TBF.Screens
// splitContainer.Panel1
//
this.splitContainer.Panel1.BackColor = System.Drawing.SystemColors.Control;
+ this.splitContainer.Panel1.Controls.Add(this.fixPreviousResultsButton);
this.splitContainer.Panel1.Controls.Add(this.label5);
this.splitContainer.Panel1.Controls.Add(this.label4);
this.splitContainer.Panel1.Controls.Add(this.label3);
@@ -88,10 +90,21 @@ namespace TBF.Screens
// splitContainer.Panel2
//
this.splitContainer.Panel2.Controls.Add(this.flowLayoutPanel);
- this.splitContainer.Size = new System.Drawing.Size(1222, 706);
+ this.splitContainer.Size = new System.Drawing.Size(1315, 706);
this.splitContainer.SplitterDistance = 42;
this.splitContainer.TabIndex = 0;
//
+ // fixPreviousResultsButton
+ //
+ this.fixPreviousResultsButton.Location = new System.Drawing.Point(1248, 10);
+ this.fixPreviousResultsButton.Name = "fixPreviousResultsButton";
+ this.fixPreviousResultsButton.Size = new System.Drawing.Size(49, 30);
+ this.fixPreviousResultsButton.TabIndex = 14;
+ this.fixPreviousResultsButton.Text = "Fix";
+ this.fixPreviousResultsButton.UseVisualStyleBackColor = true;
+ this.fixPreviousResultsButton.Visible = false;
+ this.fixPreviousResultsButton.Click += new System.EventHandler(this.fixPreviousResultsButton_Click);
+ //
// label5
//
this.label5.AutoSize = true;
@@ -231,7 +244,7 @@ namespace TBF.Screens
this.flowLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel.Location = new System.Drawing.Point(0, 0);
this.flowLayoutPanel.Name = "flowLayoutPanel";
- this.flowLayoutPanel.Size = new System.Drawing.Size(1222, 660);
+ this.flowLayoutPanel.Size = new System.Drawing.Size(1315, 660);
this.flowLayoutPanel.TabIndex = 0;
//
// ResultsTabPageCtrl
@@ -242,7 +255,7 @@ namespace TBF.Screens
this.Controls.Add(this.splitContainer);
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.Name = "ResultsTabPageCtrl";
- this.Size = new System.Drawing.Size(1222, 706);
+ this.Size = new System.Drawing.Size(1315, 706);
this.Load += new System.EventHandler(this.ResultsTabPageCtrl_Load);
this.splitContainer.Panel1.ResumeLayout(false);
this.splitContainer.Panel1.PerformLayout();
@@ -276,5 +289,6 @@ namespace TBF.Screens
private System.Windows.Forms.PictureBox pictureBox3;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.PictureBox pictureBox1;
+ private System.Windows.Forms.Button fixPreviousResultsButton;
}
}
diff --git a/TBF/Screens/ResultsTabPageCtrl.cs b/TBF/Screens/ResultsTabPageCtrl.cs
index dfdcf936a..9cc4e55fc 100644
--- a/TBF/Screens/ResultsTabPageCtrl.cs
+++ b/TBF/Screens/ResultsTabPageCtrl.cs
@@ -103,7 +103,10 @@ namespace TBF.Screens
void OnButtonsEtc(object sender, UiBridge.ButtonsEtcEventArgs args)
{
reloadPreviousResultsButton.Enabled = ((args.Flags & UiBridge.ButtonsEtc.ProcedureCmbBoxEn) != 0);
- }
+#if TURA_IPERL || TURA_SPECIAL
+ fixPreviousResultsButton.Visible = ((args.Flags & UiBridge.ButtonsEtc.ProcedureCmbBoxEn) != 0);
+#endif
+ }
private void ResultsTabPageCtrl_Load(object sender, EventArgs e)
{
@@ -112,6 +115,7 @@ namespace TBF.Screens
columnWidthsButton.Text = Strings.Save_column_widths;
showPreviousResultsButton.Text = Strings.Previous_results;
reloadPreviousResultsButton.Text = Strings.Reload_previous_results;
+ fixPreviousResultsButton.Text = Strings.Fix;
pictureBox1.BackColor = OkColor;
label1.Text = Strings.Passed;
@@ -218,9 +222,14 @@ namespace TBF.Screens
private void reloadPreviousResultsButton_Click(object sender, EventArgs e)
{
- new TBF.Forms.PreviousResultsDlg(true).ShowDialog();
+ new TBF.Forms.PreviousResultsDlg(TBF.Forms.PreviousResultsMode.Reload).ShowDialog();
}
+ private void fixPreviousResultsButton_Click(object sender, EventArgs e)
+ {
+ new TBF.Forms.PreviousResultsDlg(TBF.Forms.PreviousResultsMode.Fix).ShowDialog();
+ }
+
#region Redraw
///
diff --git a/TBF/UiBridge/Enums.cs b/TBF/UiBridge/Enums.cs
index f766ca635..884d49e6c 100644
--- a/TBF/UiBridge/Enums.cs
+++ b/TBF/UiBridge/Enums.cs
@@ -8,7 +8,8 @@ namespace TBF.UiBridge
{
None = 0,
ReloadBatch,
- StartTest,
+ ReloadAndFixBatch,
+ StartTest,
StartQ1,
StartQ2,
StartQ3,