(1) PreviousResults : 'Fix' option added to 'Send again' and 'Reload', (2) Missing PCB nr. does not cause a production tracing error.

This commit is contained in:
Milan Hanajik 2019-04-30 11:43:37 +02:00
parent 6341d5a474
commit 1e97a26863
14 changed files with 181 additions and 51 deletions

View File

@ -106,6 +106,7 @@ namespace TBF.BenchControl
/// CheckUi events
UiCmdReloadBatch,
UiCmdReloadAndFixBatch,
UiCmdStartTest,
UiCmdStartQ1,
UiCmdStartQ2,

View File

@ -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;

View File

@ -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
/// <returns>Number of written reference record</returns>
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;

View File

@ -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
/// <summary>
/// Return values of MakeSelection()
/// </summary>
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,
}
}
/// <summary>
@ -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);

View File

@ -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")
{

View File

@ -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
//

View File

@ -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));
}
}
}
}

View File

@ -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<Batch> 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<PreviousResultIdEventArgs> SendAgainHandler;
@ -291,7 +317,7 @@ namespace TBF.Forms
passedCount,
failedCount,
b.RsltsSent,
reloadEn));
mode));
}
ResumeLayout();

View File

@ -1752,6 +1752,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Fix.
/// </summary>
internal static string Fix {
get {
return ResourceManager.GetString("Fix", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Flow.
/// </summary>

View File

@ -1434,4 +1434,7 @@
<data name="Short_pulses" xml:space="preserve">
<value>Krátké impulsy</value>
</data>
<data name="Fix" xml:space="preserve">
<value>Oprav</value>
</data>
</root>

View File

@ -1981,4 +1981,7 @@
<data name="Short_pulses" xml:space="preserve">
<value>Short pulses</value>
</data>
<data name="Fix" xml:space="preserve">
<value>Fix</value>
</data>
</root>

View File

@ -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;
}
}

View File

@ -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
/// <summary>

View File

@ -8,7 +8,8 @@ namespace TBF.UiBridge
{
None = 0,
ReloadBatch,
StartTest,
ReloadAndFixBatch,
StartTest,
StartQ1,
StartQ2,
StartQ3,