diff --git a/server/lib/BlackMaple.MachineFramework/backend/BuildCellState.cs b/server/lib/BlackMaple.MachineFramework/backend/BuildCellState.cs index fc91c547..41b8b252 100644 --- a/server/lib/BlackMaple.MachineFramework/backend/BuildCellState.cs +++ b/server/lib/BlackMaple.MachineFramework/backend/BuildCellState.cs @@ -992,6 +992,8 @@ DateTime nowUTC var newEvts = db.RecordLoadUnloadComplete( toLoad: matsToLoad.Select((m) => m.Item1).ToImmutableList(), toUnload: toUnload, + previouslyLoaded: null, // TODO: previouslyLoaded + previouslyUnloaded: null, // TODO: previouslyUnloaded lulNum: loadNum, pallet: pal.PalletNum, totalElapsed: nowUTC - (LoadUnloadStartTime(pal) ?? nowUTC), diff --git a/server/lib/BlackMaple.MachineFramework/db/EventLog.cs b/server/lib/BlackMaple.MachineFramework/db/EventLog.cs index f0233a06..c708fafc 100644 --- a/server/lib/BlackMaple.MachineFramework/db/EventLog.cs +++ b/server/lib/BlackMaple.MachineFramework/db/EventLog.cs @@ -1593,7 +1593,9 @@ IReadOnlyDictionary externalQueues public IEnumerable RecordLoadUnloadComplete( IReadOnlyList toLoad, + IReadOnlyList previouslyLoaded, IReadOnlyList toUnload, + IReadOnlyList previouslyUnloaded, int lulNum, int pallet, TimeSpan totalElapsed, @@ -1650,7 +1652,46 @@ IReadOnlyDictionary externalQueues sendToExternal: sendToExternal, trans: trans ); - RecordPalletCycle(pallet: pallet, timeUTC: timeUTC, logs: logs, trans: trans, foreignId: null); + + var allUnload = (previouslyUnloaded ?? []).Concat( + (toUnload ?? []).SelectMany(u => + u.MaterialIDToQueue.Keys.Select(mid => new EventLogMaterial() + { + MaterialID = mid, + Process = u.Process, + Face = u.FaceNum, + }) + ) + ); + if (allUnload.Any()) + { + RecordPalletCycleEnd(pallet: pallet, mats: allUnload, timeUTC: timeUTC, logs: logs, trans: trans); + } + + RecordLoadMaterialPaths(toLoad: toLoad, trans: trans); + + var allLoad = (previouslyLoaded ?? []).Concat( + (toLoad ?? []).SelectMany(l => + l.MaterialIDs.Select(mid => new EventLogMaterial() + { + MaterialID = mid, + Process = l.Process, + Face = l.FaceNum, + }) + ) + ); + if (allLoad.Any()) + { + RecordPalletCycleStart( + pallet: pallet, + mats: allLoad, + timeUTC: timeUTC, + logs: logs, + trans: trans, + foreignId: null + ); + } + RecordLoadEnd( toLoad: toLoad, lulNum: lulNum, @@ -1679,7 +1720,14 @@ public IEnumerable RecordEmptyPallet(int pallet, DateTime timeUTC, str trans => { var logs = new List(); - RecordPalletCycle(pallet: pallet, timeUTC: timeUTC, logs: logs, trans: trans, foreignId: foreignId); + RecordPalletCycleStart( + pallet: pallet, + mats: [], + timeUTC: timeUTC, + logs: logs, + trans: trans, + foreignId: foreignId + ); return logs; }, foreignId: foreignId @@ -1785,13 +1833,45 @@ IDbTransaction trans } } - private void RecordPalletCycle( + private void RecordPalletCycleStart( int pallet, + IEnumerable mats, DateTime timeUTC, List logs, IDbTransaction trans, string foreignId ) + { + logs.Add( + AddLogEntry( + trans, + new NewEventLogEntry() + { + Material = mats, + Pallet = pallet, + LogType = LogType.PalletCycle, + LocationName = "Pallet Cycle", + LocationNum = 1, + Program = "", + StartOfCycle = true, + EndTimeUTC = timeUTC, + Result = "PalletCycle", + ElapsedTime = TimeSpan.Zero, + ActiveOperationTime = TimeSpan.Zero, + }, + foreignID: foreignId, + null + ) + ); + } + + private void RecordPalletCycleEnd( + int pallet, + IEnumerable mats, + DateTime timeUTC, + List logs, + IDbTransaction trans + ) { using var lastTimeCmd = _connection.CreateCommand(); lastTimeCmd.CommandText = @@ -1809,7 +1889,7 @@ string foreignId trans, new NewEventLogEntry() { - Material = [], + Material = mats, Pallet = pallet, LogType = LogType.PalletCycle, LocationName = "Pallet Cycle", @@ -1821,12 +1901,26 @@ string foreignId ElapsedTime = elapsedTime, ActiveOperationTime = TimeSpan.Zero, }, - foreignID: foreignId, + null, null ) ); } + private void RecordLoadMaterialPaths(IEnumerable toLoad, IDbTransaction trans) + { + foreach (var face in toLoad ?? []) + { + if (face.Path.HasValue) + { + foreach (var mat in face.MaterialIDs) + { + RecordPathForProcess(mat, face.Process, face.Path.Value, trans); + } + } + } + } + private void RecordLoadEnd( IEnumerable toLoad, int lulNum, @@ -1860,14 +1954,6 @@ IDbTransaction trans ); } - if (face.Path.HasValue) - { - foreach (var mat in face.MaterialIDs) - { - RecordPathForProcess(mat, face.Process, face.Path.Value, trans); - } - } - TimeSpan elapsed; if (totalActive.HasValue) { @@ -2742,7 +2828,7 @@ public SwapMaterialResult SwapMaterialInCurrentPalletCycle( } // load old events - var oldEvents = CurrentPalletLog(pallet, includeLastPalletCycleEvt: false, trans); + var oldEvents = CurrentPalletLog(pallet, includeLastPalletCycleEvt: true, trans); var oldMatProcM = oldEvents .SelectMany(e => e.Material) .Where(m => m.MaterialID == oldMatId) diff --git a/server/lib/BlackMaple.MachineFramework/db/IRepository.cs b/server/lib/BlackMaple.MachineFramework/db/IRepository.cs index ae833bed..36cc1341 100644 --- a/server/lib/BlackMaple.MachineFramework/db/IRepository.cs +++ b/server/lib/BlackMaple.MachineFramework/db/IRepository.cs @@ -102,7 +102,9 @@ IReadOnlyDictionary externalQueues ); IEnumerable RecordLoadUnloadComplete( IReadOnlyList toLoad, + IReadOnlyList previouslyLoaded, IReadOnlyList toUnload, + IReadOnlyList previouslyUnloaded, int lulNum, int pallet, TimeSpan totalElapsed, diff --git a/server/machines/makino/LogBuilder.cs b/server/machines/makino/LogBuilder.cs index d094efa4..ef501305 100644 --- a/server/machines/makino/LogBuilder.cs +++ b/server/machines/makino/LogBuilder.cs @@ -375,7 +375,9 @@ ref bool newLogEntries { logDb.RecordLoadUnloadComplete( toLoad: toLoad, + previouslyLoaded: [], toUnload: toUnload, + previouslyUnloaded: [], lulNum: loc.Num, pallet: ws.Key.PalletID, totalElapsed: elapsed, diff --git a/server/machines/mazak/sync/LogTranslation.cs b/server/machines/mazak/sync/LogTranslation.cs index 16aad633..b6dfcdf8 100644 --- a/server/machines/mazak/sync/LogTranslation.cs +++ b/server/machines/mazak/sync/LogTranslation.cs @@ -255,7 +255,9 @@ private void HandleLoadEnd(IReadOnlyList es) repo.RecordLoadUnloadComplete( toLoad: toLoad, + previouslyLoaded: null, toUnload: toUnload, + previouslyUnloaded: null, pallet: pallet, lulNum: es[0].StationNumber, totalElapsed: CalculateElapsed(es[0].TimeUTC, LogType.LoadUnloadCycle, cycle, es[0].StationNumber), diff --git a/server/machines/niigata/CellState.cs b/server/machines/niigata/CellState.cs index 76432550..f459b9ed 100644 --- a/server/machines/niigata/CellState.cs +++ b/server/machines/niigata/CellState.cs @@ -979,7 +979,9 @@ IRepository logDB var lulEvts = logDB.RecordLoadUnloadComplete( toLoad: toLoad, + previouslyLoaded: null, toUnload: toUnload, + previouslyUnloaded: null, lulNum: loadBegin.LocationNum, pallet: pallet.Status.Master.PalletNum, totalElapsed: nowUtc.Subtract(loadBegin.EndTimeUTC), diff --git a/server/test/InspectionTest.cs b/server/test/InspectionTest.cs index 003b354a..80bdf626 100644 --- a/server/test/InspectionTest.cs +++ b/server/test/InspectionTest.cs @@ -482,6 +482,8 @@ private void AddCycle(LogMaterial[] mat, int pal, LogType loc, int statNum) }, ], toUnload: null, + previouslyLoaded: null, + previouslyUnloaded: null, lulNum: statNum, totalElapsed: TimeSpan.FromMinutes(10), pallet: pal, diff --git a/server/test/JobLogTest.cs b/server/test/JobLogTest.cs index e82464fd..7cffebc8 100644 --- a/server/test/JobLogTest.cs +++ b/server/test/JobLogTest.cs @@ -428,6 +428,28 @@ public void AddLog() "2" ); + var mat300 = MkLogMat.Mk( + _jobLog.AllocateMaterialID("loc2", "face2", 14), + "loc2", + 4, + "face2", + 14, + "", + "", + "2" + ); + + var mat400 = MkLogMat.Mk( + _jobLog.AllocateMaterialID("loc2", "face2", 14), + "loc2", + 4, + "face2", + 14, + "", + "", + "2" + ); + var loadEndActualCycle = _jobLog.RecordLoadUnloadComplete( toLoad: new[] { @@ -456,6 +478,7 @@ public void AddLog() ActiveOperationTime = TimeSpan.FromMinutes(333), }, }, + previouslyLoaded: [EventLogMaterial.FromLogMat(mat300)], toUnload: [ new MaterialToUnloadFromFace() @@ -475,6 +498,7 @@ public void AddLog() ActiveOperationTime = TimeSpan.FromMinutes(211), }, ], + previouslyUnloaded: [EventLogMaterial.FromLogMat(mat400)], lulNum: 111, totalElapsed: TimeSpan.FromMinutes(40000), pallet: 1234, @@ -517,7 +541,7 @@ public void AddLog() new LogEntry() { Counter = -1, - Material = [], + Material = [mat20, mat19 with { Face = 22, Process = 1 }, mat1, mat400], Pallet = 1234, LogType = LogType.PalletCycle, LocationName = "Pallet Cycle", @@ -529,6 +553,34 @@ public void AddLog() ElapsedTime = TimeSpan.Zero, ActiveOperationTime = TimeSpan.Zero, }, + new LogEntry() + { + Counter = -1, + Material = + [ + mat2, + mat15, + matLoc2Face1 with + { + Path = 33, + }, + matLoc2Face2 with + { + Path = 44, + }, + mat300, + ], + Pallet = 1234, + LogType = LogType.PalletCycle, + LocationName = "Pallet Cycle", + LocationNum = 1, + Program = "", + StartOfCycle = true, + EndTimeUTC = start.AddHours(3), + Result = "PalletCycle", + ElapsedTime = TimeSpan.Zero, + ActiveOperationTime = TimeSpan.Zero, + }, new LogEntry( -1, new LogMaterial[] { mat2, mat15 }, @@ -576,7 +628,11 @@ public void AddLog() ); logs.AddRange(loadEndActualCycle); logsForMat1.Add(loadEndActualCycle.Skip(1).First()); - logsForMat2.Add(loadEndActualCycle.Skip(3).First()); + logsForMat1.AddRange( + loadEndActualCycle.Where(e => e.LogType == LogType.PalletCycle && !e.StartOfCycle) + ); + logsForMat2.Add(loadEndActualCycle.Skip(4).First()); + logsForMat2.AddRange(loadEndActualCycle.Where(e => e.LogType == LogType.PalletCycle && e.StartOfCycle)); _jobLog.ToolPocketSnapshotForCycle(loadEndActualCycle.First().Counter).Should().BeEmpty(); _jobLog .GetMaterialDetails(matLoc2Face1.MaterialID) @@ -814,6 +870,8 @@ public void AddLog() ActiveOperationTime = TimeSpan.FromSeconds(55), }, ], + previouslyLoaded: null, + previouslyUnloaded: null, pallet: 3, lulNum: 14, timeUTC: start.AddHours(7), @@ -842,7 +900,7 @@ public void AddLog() new LogEntry() { Counter = -1, - Material = [], + Material = [mat2, mat20], Pallet = 3, LogType = LogType.PalletCycle, LocationName = "Pallet Cycle", @@ -858,7 +916,7 @@ public void AddLog() options => options.ComparingByMembers().Excluding(x => x.Counter) ); logs.AddRange(unloadEndActualCycle); - logsForMat2.Add(unloadEndActualCycle.First()); + logsForMat2.AddRange(unloadEndActualCycle); // ----- check loading of logs ----- @@ -1170,6 +1228,8 @@ public void LookupByPallet() }, ], toUnload: null, + previouslyLoaded: null, + previouslyUnloaded: null, pallet: 1, lulNum: 2, totalElapsed: TimeSpan.FromMinutes(10), @@ -1208,12 +1268,12 @@ public void LookupByPallet() CheckLog(pal1Initial, _jobLog.CurrentPalletLog(1), DateTime.UtcNow.AddHours(-10)); CheckLog( - [loadStart, .. pal1Initial], + [loadStart, initialPalCycle, .. pal1Initial], _jobLog.GetLogForMaterial(mat1.MaterialID, includeInvalidatedCycles: false).ToList(), DateTime.UtcNow.AddHours(-10) ); CheckLog( - [loadStart, .. pal1Initial], + [loadStart, initialPalCycle, .. pal1Initial], _jobLog .GetLogForMaterial([mat1.MaterialID, mat2.MaterialID], includeInvalidatedCycles: false) .ToList(), @@ -1221,15 +1281,7 @@ public void LookupByPallet() ); _jobLog.CurrentPalletLog(2).Should().BeEmpty(); - var pal1CycleEvt = _jobLog.RecordLoadUnloadComplete( - toLoad: null, - toUnload: null, - lulNum: 2, - pallet: 1, - totalElapsed: TimeSpan.Zero, - timeUTC: pal1InitialTime.AddMinutes(25), - externalQueues: null - ); + var pal1CycleEvt = _jobLog.RecordEmptyPallet(pallet: 1, timeUTC: pal1InitialTime.AddMinutes(25)); pal1CycleEvt .Should() @@ -1243,10 +1295,10 @@ public void LookupByPallet() "Pallet Cycle", 1, "", - false, + true, pal1InitialTime.AddMinutes(25), "PalletCycle", - TimeSpan.FromMinutes(25 - 5), + TimeSpan.Zero, TimeSpan.Zero ), ], @@ -1310,6 +1362,8 @@ public void LookupByPallet() }, ], toUnload: [], + previouslyLoaded: null, + previouslyUnloaded: null, pallet: 1, lulNum: 2, timeUTC: pal1CycleTime.AddMinutes(15), @@ -1317,6 +1371,7 @@ public void LookupByPallet() externalQueues: null ); + var pal1PalletCycle = pal1LoadComp.First(e => e.LogType == LogType.PalletCycle); pal1Cycle.Add(pal1LoadComp.First(e => e.LogType != LogType.PalletCycle)); // *********** Add pal1 start of machining @@ -1352,12 +1407,12 @@ public void LookupByPallet() CheckLog(pal1Cycle, _jobLog.CurrentPalletLog(1), DateTime.UtcNow.AddHours(-10)); CheckLog(pal2Cycle, _jobLog.CurrentPalletLog(2), DateTime.UtcNow.AddHours(-10)); CheckLog( - [loadStart, .. pal1Initial, .. pal1Cycle, .. pal2Cycle], + [loadStart, initialPalCycle, .. pal1Initial, pal1PalletCycle, .. pal1Cycle, .. pal2Cycle], _jobLog.GetLogForMaterial(mat1.MaterialID, includeInvalidatedCycles: false).ToList(), DateTime.UtcNow.AddHours(-10) ); CheckLog( - [loadStart, .. pal1Initial, .. pal1Cycle, .. pal2Cycle], + [loadStart, initialPalCycle, .. pal1Initial, pal1PalletCycle, .. pal1Cycle, .. pal2Cycle], _jobLog .GetLogForMaterial([mat1.MaterialID, mat2.MaterialID], includeInvalidatedCycles: false) .ToList(), @@ -1378,12 +1433,12 @@ public void LookupByPallet() // invalidated not added to pal1Cycle CheckLog(pal1Cycle, _jobLog.CurrentPalletLog(1), DateTime.UtcNow.AddHours(-10)); CheckLog( - [loadStart, .. pal1Initial, .. pal1Cycle, .. pal2Cycle], + [loadStart, initialPalCycle, .. pal1Initial, pal1PalletCycle, .. pal1Cycle, .. pal2Cycle], _jobLog.GetLogForMaterial(mat1.MaterialID, includeInvalidatedCycles: false).ToList(), DateTime.UtcNow.AddHours(-10) ); CheckLog( - [loadStart, .. pal1Initial, .. pal1Cycle, .. pal2Cycle], + [loadStart, initialPalCycle, .. pal1Initial, pal1PalletCycle, .. pal1Cycle, .. pal2Cycle], _jobLog .GetLogForMaterial([mat1.MaterialID, mat2.MaterialID], includeInvalidatedCycles: false) .ToList(), @@ -1400,10 +1455,10 @@ public void LookupByPallet() "Pallet Cycle", 1, "", - false, + true, pal1CycleTime.AddMinutes(40), "PalletCycle", - TimeSpan.FromMinutes(40 - 15), + TimeSpan.Zero, TimeSpan.Zero ) ); @@ -1752,6 +1807,8 @@ public void WorkorderSummary() ActiveOperationTime = TimeSpan.FromMinutes(6), }, ], + previouslyLoaded: null, + previouslyUnloaded: null, pallet: 1, lulNum: 5, timeUTC: t.AddMinutes(17), @@ -2105,6 +2162,8 @@ public void LoadCompletedParts() }, ], toUnload: null, + previouslyLoaded: null, + previouslyUnloaded: null, lulNum: 5, pallet: 1, timeUTC: old.AddMinutes(6), @@ -2134,6 +2193,8 @@ public void LoadCompletedParts() ActiveOperationTime = TimeSpan.FromMinutes(40), }, ], + previouslyLoaded: null, + previouslyUnloaded: null, pallet: 1, lulNum: 5, timeUTC: recent.AddMinutes(4), @@ -2165,6 +2226,8 @@ public void LoadCompletedParts() ActiveOperationTime = TimeSpan.FromMinutes(61), }, ], + previouslyLoaded: null, + previouslyUnloaded: null, pallet: 1, lulNum: 5, timeUTC: recent.AddMinutes(6), @@ -2207,6 +2270,8 @@ public void LoadCompletedParts() ActiveOperationTime = TimeSpan.FromMinutes(81), }, ], + previouslyLoaded: null, + previouslyUnloaded: null, pallet: 1, lulNum: 5, timeUTC: old.AddMinutes(25), @@ -2238,6 +2303,8 @@ public void LoadCompletedParts() ActiveOperationTime = TimeSpan.FromMinutes(101), }, ], + previouslyLoaded: null, + previouslyUnloaded: null, pallet: 1, lulNum: 5, timeUTC: recent.AddMinutes(45), @@ -2258,7 +2325,7 @@ public void LoadCompletedParts() mat4recent, .. mat4complete, ] - ).Where(e => e.LogType != LogType.PalletCycle), + ), DateTime.MinValue ); @@ -3278,6 +3345,8 @@ public void LoadUnloadIntoQueues() MaterialIDs = ImmutableList.Create(mat1.MaterialID), }, }, + previouslyLoaded: null, + previouslyUnloaded: null, toUnload: null, pallet: 1, lulNum: 16, @@ -3293,14 +3362,14 @@ public void LoadUnloadIntoQueues() new LogEntry() { Counter = 3, - Material = [], + Material = [mat1 with { Face = 1234 }], Pallet = 1, LogType = LogType.PalletCycle, LocationName = "Pallet Cycle", LocationNum = 1, Program = "", Result = "PalletCycle", - StartOfCycle = false, + StartOfCycle = true, EndTimeUTC = start.AddMinutes(10), ElapsedTime = TimeSpan.Zero, ActiveOperationTime = TimeSpan.Zero, @@ -3373,6 +3442,8 @@ public void LoadUnloadIntoQueues() ActiveOperationTime = TimeSpan.FromMinutes(23), }, ], + previouslyLoaded: null, + previouslyUnloaded: null, pallet: 5, lulNum: 77, timeUTC: start.AddMinutes(30), @@ -3414,7 +3485,7 @@ mat3 with { Counter = 9, LogType = LogType.PalletCycle, - Material = [], + Material = [mat1, mat3 with { Process = mat1.Process }, mat4 with { Process = mat1.Process }], Pallet = 5, LocationName = "Pallet Cycle", LocationNum = 1, @@ -3875,6 +3946,8 @@ public void ReuseMatIDsWhenBulkAdding() MaterialIDs = ImmutableList.Create(5L), }, ], + previouslyLoaded: null, + previouslyUnloaded: null, toUnload: null, pallet: 5, lulNum: 1, @@ -4197,6 +4270,8 @@ public void OverrideMatOnPal(bool firstPalletCycle, bool newMatUnassigned, strin MaterialIDs = ImmutableList.Create(firstMat.MaterialID), }, ], + previouslyLoaded: null, + previouslyUnloaded: null, toUnload: null, lulNum: 3, pallet: 5, @@ -4333,6 +4408,8 @@ public void OverrideMatOnPal(bool firstPalletCycle, bool newMatUnassigned, strin MaterialIDs = ImmutableList.Create(initiallyLoadedMatProc1.MaterialID), }, ], + previouslyLoaded: null, + previouslyUnloaded: null, toUnload: null, lulNum: 2, totalElapsed: TimeSpan.FromMinutes(4), @@ -4351,7 +4428,7 @@ public void OverrideMatOnPal(bool firstPalletCycle, bool newMatUnassigned, strin .Be(initiallyLoadedMatProc1.MaterialID); loadEndOrigEvts.Skip(1).First().Material.First().Process.Should().Be(0); loadEndOrigEvts.Last().LogType.Should().Be(LogType.LoadUnloadCycle); - origLog.Add(loadEndOrigEvts.Last()); + origLog.AddRange(loadEndOrigEvts.Where(e => e.LogType != LogType.RemoveFromQueue)); var initialMatRemoveQueueTime = now; @@ -4542,6 +4619,12 @@ newLogMatProc0 with ) .ToList(); + result + .ChangedLogEntries.GroupBy(e => e.LogType) + .ToDictionary(g => g.Key, g => g.Count()) + .Should() + .BeEquivalentTo(newLog.GroupBy(e => e.LogType).ToDictionary(g => g.Key, g => g.Count())); + result .ChangedLogEntries.Should() .BeEquivalentTo(newLog, options => options.Excluding(e => e.Counter).ComparingByMembers()); @@ -4664,6 +4747,7 @@ newLogMatProc0 with && e.LogType != LogType.PalletInStocker && e.LogType != LogType.PalletOnRotaryInbound && e.LogType != LogType.SwapMaterialOnPallet + && e.LogType != LogType.PalletCycle ) .SelectMany(e => e.Material) .Select(m => m.Process) @@ -4727,6 +4811,8 @@ public void ErrorsOnBadOverrideMatOnPal() MaterialIDs = ImmutableList.Create(firstMat.MaterialID), }, ], + previouslyLoaded: null, + previouslyUnloaded: null, toUnload: null, lulNum: 3, totalElapsed: TimeSpan.FromMinutes(4), @@ -4869,6 +4955,8 @@ public void InvalidatesCycle() MaterialIDs = ImmutableList.Create(matProc1.MaterialID), }, ], + previouslyLoaded: null, + previouslyUnloaded: null, toUnload: null, pallet: 5, lulNum: 2, @@ -4883,6 +4971,7 @@ public void InvalidatesCycle() loadEndOrigEvts.Skip(1).First().Material.First().Process.Should().Be(0); loadEndOrigEvts.Last().LogType.Should().Be(LogType.LoadUnloadCycle); origMatLog.Add(loadEndOrigEvts.Last()); + origPalLog.Add(loadEndOrigEvts.First(l => l.LogType == LogType.PalletCycle)); var initialMatRemoveQueueTime = now; @@ -5294,6 +5383,8 @@ public async Task ExternalQueues() ActiveOperationTime = TimeSpan.FromMinutes(5), }, ], + previouslyLoaded: null, + previouslyUnloaded: null, lulNum: 10, pallet: 20, totalElapsed: TimeSpan.FromMinutes(6), @@ -5306,7 +5397,20 @@ public async Task ExternalQueues() new LogEntry() { Counter = 3, - Material = [], + Material = + [ + new LogMaterial() + { + MaterialID = mat1, + Process = 1, + Face = 1, + JobUniqueStr = "uuu1", + NumProcesses = 2, + PartName = partName, + Serial = serial, + Workorder = "", + }, + ], LogType = LogType.PalletCycle, LocationName = "Pallet Cycle", LocationNum = 1, @@ -5507,6 +5611,12 @@ public static long CheckLog( System.DateTime start ) { + logs.Where(l => l.EndTimeUTC >= start) + .GroupBy(l => l.LogType) + .ToDictionary(ls => ls.Key, ls => ls.Count()) + .Should() + .BeEquivalentTo(otherLogs.GroupBy(l => l.LogType).ToDictionary(ls => ls.Key, ls => ls.Count())); + logs.Where(l => l.EndTimeUTC >= start) .Should() .BeEquivalentTo( diff --git a/server/test/mazak/SyncSpec.cs b/server/test/mazak/SyncSpec.cs index 29921c4b..3ca16d72 100644 --- a/server/test/mazak/SyncSpec.cs +++ b/server/test/mazak/SyncSpec.cs @@ -492,6 +492,8 @@ public void QuarantinesMaterial() }, ], toUnload: null, + previouslyLoaded: null, + previouslyUnloaded: null, lulNum: 2, pallet: 4, totalElapsed: TimeSpan.FromMinutes(1),