From 33d8ef342778eda416c9f606a954812521230057 Mon Sep 17 00:00:00 2001 From: John Lenz Date: Tue, 12 Nov 2024 11:11:12 -0600 Subject: [PATCH] mazak: add pallets on hold that have no scheduled jobs --- .../machines/mazak/sync/BuildCurrentStatus.cs | 19 +++++++++++++++++++ .../basic-no-material.data.json | 18 ++++++++++++++++++ .../basic-no-material.status.json | 13 ++++++++++++- 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/server/machines/mazak/sync/BuildCurrentStatus.cs b/server/machines/mazak/sync/BuildCurrentStatus.cs index d785c8ed8..727e839bd 100644 --- a/server/machines/mazak/sync/BuildCurrentStatus.cs +++ b/server/machines/mazak/sync/BuildCurrentStatus.cs @@ -363,6 +363,25 @@ DateTime utcNow } } + // add any pallets on hold that are not currently used in any parts + foreach (var pal in palOnHold?.Where(p => p.Value) ?? []) + { + if (!palletsByName.ContainsKey(pal.Key)) + { + palletsByName.Add( + pal.Key, + new PalletStatus() + { + PalletNum = pal.Key, + CurrentPalletLocation = FindPalletLocation(machineGroupName, mazakData, mazakCfg, pal.Key), + FixtureOnPallet = "", + NumFaces = 1, + OnHold = true, + } + ); + } + } + //now queued var seenMatIds = new HashSet(material.Select(m => m.MaterialID)); material.AddRange( diff --git a/server/test/mazak/read-snapshots/basic-no-material.data.json b/server/test/mazak/read-snapshots/basic-no-material.data.json index ad906538b..ab8c39ae9 100644 --- a/server/test/mazak/read-snapshots/basic-no-material.data.json +++ b/server/test/mazak/read-snapshots/basic-no-material.data.json @@ -174,6 +174,20 @@ "FixtureGroupV2": 4 } ], + "PalletStatuses": [ + { + "PalletNumber": 2, + "IsOnHold": 1 + }, + { + "PalletNumber": 5, + "IsOnHold": 0 + }, + { + "PalletNumber": 15, + "IsOnHold": 1 + } + ], "PalletSubStatuses": [], "PalletPositions": [ { @@ -195,6 +209,10 @@ { "PalletNumber": 5, "PalletPosition": "S005" + }, + { + "PalletNumber": 15, + "PalletPosition": "S015" } ], "LoadActions": [], diff --git a/server/test/mazak/read-snapshots/basic-no-material.status.json b/server/test/mazak/read-snapshots/basic-no-material.status.json index 44cf58e54..cbd972e55 100644 --- a/server/test/mazak/read-snapshots/basic-no-material.status.json +++ b/server/test/mazak/read-snapshots/basic-no-material.status.json @@ -666,13 +666,24 @@ "2": { "PalletNum": 2, "FixtureOnPallet": "F:0:fixtureBB:1", - "OnHold": false, + "OnHold": true, "CurrentPalletLocation": { "loc": "Buffer", "group": "Buffer", "num": 2 }, "NumFaces": 1 + }, + "15": { + "PalletNum": 15, + "FixtureOnPallet": "", + "OnHold": true, + "CurrentPalletLocation": { + "loc": "Buffer", + "group": "Buffer", + "num": 15 + }, + "NumFaces": 1 } }, "Material": [],