(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 13:17:08 +02:00
parent 6341d5a474
commit 1e97a26863
14 changed files with 181 additions and 51 deletions
+1
View File
@@ -106,6 +106,7 @@ namespace TBF.BenchControl
/// CheckUi events
UiCmdReloadBatch,
UiCmdReloadAndFixBatch,
UiCmdStartTest,
UiCmdStartQ1,
UiCmdStartQ2,
+1
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;
@@ -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;
+52 -18
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);
@@ -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")
{