@seedtactics/insight-client 17.0.1-beta.1 → 17.0.1-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/assets/ProgramHighlight-C6zSEXCX.js +3 -0
  2. package/dist/assets/index-BaeSfExJ.js +388 -0
  3. package/dist/cell-status/inspections.js +0 -20
  4. package/dist/cell-status/material-details.js +7 -1
  5. package/dist/cell-status/material-summary.js +1 -87
  6. package/dist/cell-status/station-cycles.d.ts +1 -0
  7. package/dist/cell-status/station-cycles.js +11 -14
  8. package/dist/components/LogEntry.js +0 -71
  9. package/dist/components/log-entry-container-name.d.ts +2 -2
  10. package/dist/components/log-entry-container-name.js +1 -7
  11. package/dist/components/operations/AllMaterial.js +2 -4
  12. package/dist/components/operations/CompletedParts.js +10 -10
  13. package/dist/components/operations/Programs.js +24 -17
  14. package/dist/components/operations/Rebookings.js +1 -1
  15. package/dist/components/quality/RecentFailedInspections.js +1 -1
  16. package/dist/components/routes.js +1 -2
  17. package/dist/components/station-monitor/BasketLoadStationWork.js +66 -16
  18. package/dist/components/station-monitor/BasketMovementArrival.d.ts +4 -2
  19. package/dist/components/station-monitor/BasketMovementArrival.js +23 -33
  20. package/dist/components/station-monitor/BulkRawMaterial.js +25 -14
  21. package/dist/components/station-monitor/CancelLoadButton.js +3 -1
  22. package/dist/components/station-monitor/InvalidateCycle.d.ts +1 -17
  23. package/dist/components/station-monitor/InvalidateCycle.js +2 -92
  24. package/dist/components/station-monitor/LoadStation.js +36 -18
  25. package/dist/components/station-monitor/Material.js +33 -31
  26. package/dist/components/station-monitor/PrintedLabel.js +2 -2
  27. package/dist/components/station-monitor/QuarantineButton.js +4 -4
  28. package/dist/components/station-monitor/SystemOverview.js +33 -31
  29. package/dist/data/all-material-bins.js +15 -11
  30. package/dist/data/current-cycles.js +6 -3
  31. package/dist/data/inspection-sankey.js +1 -1
  32. package/dist/data/results.completed-parts.js +1 -1
  33. package/dist/data/results.cycles.js +1 -1
  34. package/dist/data/results.schedules.js +1 -1
  35. package/dist/index.html +1 -1
  36. package/dist/network/api.d.ts +31 -50
  37. package/dist/network/api.js +55 -141
  38. package/dist/network/backend-mock.js +0 -3
  39. package/dist/network/backend.d.ts +0 -1
  40. package/docs/mazak.md +13 -0
  41. package/docs/operator-procedures.md +6 -6
  42. package/package.json +20 -20
  43. package/dist/assets/ProgramHighlight-DPTeZ8Si.js +0 -3
  44. package/dist/assets/index-C4HZdhRu.js +0 -388
@@ -31,7 +31,7 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31
31
  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32
32
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
33
  */
34
- import { PureComponent, forwardRef, memo, useState, Suspense, } from "react";
34
+ import { PureComponent, memo, useState, Suspense, } from "react";
35
35
  import * as jdenticon from "jdenticon";
36
36
  import { Typography, Badge, Box, ButtonBase, Button, Tooltip, Avatar, Paper, CircularProgress, TextField, Dialog, DialogActions, DialogContent, DialogTitle, keyframes, styled, } from "@mui/material";
37
37
  import TimeAgo from "react-timeago";
@@ -48,7 +48,7 @@ import { currentStatus } from "../../cell-status/current-status.js";
48
48
  import { useAtom, useAtomValue, useSetAtom } from "jotai";
49
49
  import { last30Rebookings } from "../../cell-status/rebookings.js";
50
50
  import { fmsInformation } from "../../network/server-settings.js";
51
- import { basketDisplayName } from "../../cell-status/station-cycles.js";
51
+ import { basketDisplayName, basketSlotLabel } from "../../cell-status/station-cycles.js";
52
52
  import { materialOperationState } from "../../data/material-operation-policy.js";
53
53
  export class PartIdenticon extends PureComponent {
54
54
  render() {
@@ -236,12 +236,14 @@ export function MaterialAction({ mat, displayActionForSinglePallet, fsize, }) {
236
236
  }
237
237
  }
238
238
  case api.ActionType.LoadingToBasket:
239
- return (_jsxs(MatCardDetail, { fsize: fsize, children: ["Load into ", basketName, " ", mat.action.loadToBasketId ?? "", mat.action.loadToBasketSlot !== undefined ? ` slot ${mat.action.loadToBasketSlot}` : ""] }));
239
+ return (_jsxs(MatCardDetail, { fsize: fsize, children: ["Load into ", basketName, " ", mat.action.loadToBasketId ?? "", mat.action.loadToBasketSlot !== undefined
240
+ ? ` slot ${basketSlotLabel(mat.action.loadToBasketSlot)}`
241
+ : ""] }));
240
242
  case api.ActionType.UnloadToInProcess:
241
243
  case api.ActionType.UnloadToCompletedMaterial:
242
244
  if (mat.action.unloadToBasketId) {
243
245
  return (_jsxs(MatCardDetail, { fsize: fsize, children: ["Unload to ", basketName, " ", mat.action.unloadToBasketId, mat.action.unloadToBasketSlot !== undefined
244
- ? ` slot ${mat.action.unloadToBasketSlot}`
246
+ ? ` slot ${basketSlotLabel(mat.action.unloadToBasketSlot)}`
245
247
  : ""] }));
246
248
  }
247
249
  else if (mat.action.unloadIntoQueue) {
@@ -338,54 +340,54 @@ export function WorkorderFromBarcode() {
338
340
  const comments = currentSt.workorders?.find((w) => w.workorderId === workorderId)?.comments ?? [];
339
341
  return (_jsxs("div", { style: { marginTop: "1em", marginLeft: "1em" }, children: [_jsxs("p", { children: ["Workorder: ", workorderId] }), _jsx("ul", { children: comments.map((c, idx) => (_jsx("li", { children: c.comment }, idx))) })] }));
340
342
  }
341
- const MatCard = forwardRef(function MatCard(props, ref) {
343
+ const MatCard = function MatCard({ mat, inProcMat, fsize, focusInspectionType, isDragOverlay, isActiveDrag, shake, dragRootProps, showDragHandle, setDragHandleRef, dragHandleProps, displayJob, hideEmptySerial, showRawMaterial, showJobComment, displayActionForSinglePallet, hideAvatar, hideWarningIcon, ref, }) {
342
344
  const setMatToShow = useSetAtom(matDetails.materialDialogOpen);
343
- const completed = props.mat.completedInspections || {};
345
+ const completed = mat.completedInspections || {};
344
346
  let completedMsg;
345
- if (props.focusInspectionType && completed[props.focusInspectionType]) {
346
- completedMsg = (_jsxs(MatCardDetail, { fsize: props.fsize, children: [_jsx("span", { children: "Inspection completed " }), _jsx(TimeAgo, { date: completed[props.focusInspectionType].time })] }));
347
+ if (focusInspectionType && completed[focusInspectionType]) {
348
+ completedMsg = (_jsxs(MatCardDetail, { fsize: fsize, children: [_jsx("span", { children: "Inspection completed " }), _jsx(TimeAgo, { date: completed[focusInspectionType].time })] }));
347
349
  }
348
- else if (props.focusInspectionType && props.mat.last_unload_time) {
349
- completedMsg = (_jsxs(MatCardDetail, { fsize: props.fsize, children: [_jsx("span", { children: "Unloaded " }), _jsx(TimeAgo, { date: props.mat.last_unload_time })] }));
350
+ else if (focusInspectionType && mat.last_unload_time) {
351
+ completedMsg = (_jsxs(MatCardDetail, { fsize: fsize, children: [_jsx("span", { children: "Unloaded " }), _jsx(TimeAgo, { date: mat.last_unload_time })] }));
350
352
  }
351
- else if (props.mat.closeout_completed) {
352
- completedMsg = (_jsxs(MatCardDetail, { fsize: props.fsize, children: [_jsxs("span", { children: [props.mat.closeout_failed ? "Failed " : "", "Closed Out "] }), _jsx(TimeAgo, { date: props.mat.closeout_completed })] }));
353
+ else if (mat.closeout_completed) {
354
+ completedMsg = (_jsxs(MatCardDetail, { fsize: fsize, children: [_jsxs("span", { children: [mat.closeout_failed ? "Failed " : "", "Closed Out "] }), _jsx(TimeAgo, { date: mat.closeout_completed })] }));
353
355
  }
354
356
  return (_jsxs(Paper, { ref: ref, elevation: 4, sx: {
355
357
  display: "flex",
356
358
  minWidth: "10em",
357
359
  padding: "8px",
358
- margin: props.isDragOverlay ? undefined : "8px",
359
- opacity: props.isActiveDrag ? 0.2 : 1,
360
- animation: props.shake ? shakeHorizAnimation : undefined,
360
+ margin: isDragOverlay ? undefined : "8px",
361
+ opacity: isActiveDrag ? 0.2 : 1,
362
+ animation: shake ? shakeHorizAnimation : undefined,
361
363
  "&:hover": {
362
364
  animationPlayState: "paused",
363
365
  },
364
- }, onAnimationIteration: shakeAnimationIteration, ...props.dragRootProps, children: [props.showDragHandle ? (_jsx("div", { ref: props.setDragHandleRef, role: "button", tabIndex: 0, style: {
366
+ }, onAnimationIteration: shakeAnimationIteration, ...dragRootProps, children: [showDragHandle ? (_jsx("div", { ref: setDragHandleRef, role: "button", tabIndex: 0, style: {
365
367
  display: "flex",
366
368
  flexDirection: "column",
367
369
  justifyContent: "center",
368
- cursor: props.isDragOverlay ? "grabbing" : "grab",
370
+ cursor: isDragOverlay ? "grabbing" : "grab",
369
371
  touchAction: "none",
370
- }, ...props.dragHandleProps, children: _jsx(DragIndicator, { fontSize: "large", color: "action" }) })) : undefined, _jsx(ButtonBase, { focusRipple: true, sx: { width: "100%" }, onClick: () => setMatToShow(props.inProcMat
371
- ? { type: "InProcMat", inproc: props.inProcMat }
372
- : { type: "MatSummary", summary: props.mat }), children: _jsxs(Box, { sx: {
372
+ }, ...dragHandleProps, children: _jsx(DragIndicator, { fontSize: "large", color: "action" }) })) : undefined, _jsx(ButtonBase, { focusRipple: true, sx: { width: "100%" }, onClick: () => setMatToShow(inProcMat
373
+ ? { type: "InProcMat", inproc: inProcMat }
374
+ : { type: "MatSummary", summary: mat }), children: _jsxs(Box, { sx: {
373
375
  display: "flex",
374
376
  textAlign: "left",
375
377
  alignItems: "center",
376
378
  width: "100%",
377
- }, children: [_jsx(PartIdenticon, { part: props.mat.partName }), _jsxs(Box, { sx: {
379
+ }, children: [_jsx(PartIdenticon, { part: mat.partName }), _jsxs(Box, { sx: {
378
380
  marginLeft: "8px",
379
381
  flexGrow: 1,
380
382
  minWidth: 0,
381
- }, children: [_jsx(MatCardHeader, { fsize: props.fsize, children: props.mat.partName }), props.displayJob ? (_jsx(MatCardDetail, { fsize: props.fsize, children: props.mat.jobUnique && props.mat.jobUnique !== ""
382
- ? "Assigned to " + props.mat.jobUnique
383
- : "Unassigned material" })) : undefined, !props.hideEmptySerial || props.mat.serial ? (_jsxs(MatCardDetail, { fsize: props.fsize, children: ["Serial: ", props.mat.serial ? props.mat.serial : "none"] })) : undefined, props.mat.workorderId === undefined ||
384
- props.mat.workorderId === "" ||
385
- props.mat.workorderId === props.mat.serial ? undefined : (_jsxs(MatCardDetail, { fsize: props.fsize, children: ["Workorder: ", props.mat.workorderId] })), props.mat.jobUnique !== undefined &&
386
- props.showRawMaterial &&
387
- props.inProcMat &&
388
- props.inProcMat.process === 0 ? (_jsx(JobRawMaterial, { fsize: props.fsize, mat: props.inProcMat })) : undefined, props.showJobComment && props.mat.jobUnique && props.mat.jobUnique !== "" ? (_jsx(RebookingNoteElipsis, { fsize: props.fsize, uniq: props.mat.jobUnique })) : undefined, props.inProcMat ? (_jsx(MaterialAction, { mat: props.inProcMat, displayActionForSinglePallet: props.displayActionForSinglePallet, fsize: props.fsize })) : undefined, props.inProcMat?.problem ? (_jsx(MatCardDetail, { fsize: props.fsize, children: _jsxs(Typography, { variant: "body2", color: "error", sx: { fontWeight: "bold" }, children: ["\u26A0 ", props.inProcMat.problem] }) })) : undefined, completedMsg] }), _jsxs(Box, { sx: {
383
+ }, children: [_jsx(MatCardHeader, { fsize: fsize, children: mat.partName }), displayJob ? (_jsx(MatCardDetail, { fsize: fsize, children: mat.jobUnique && mat.jobUnique !== ""
384
+ ? "Assigned to " + mat.jobUnique
385
+ : "Unassigned material" })) : undefined, !hideEmptySerial || mat.serial ? (_jsxs(MatCardDetail, { fsize: fsize, children: ["Serial: ", mat.serial ? mat.serial : "none"] })) : undefined, mat.workorderId === undefined ||
386
+ mat.workorderId === "" ||
387
+ mat.workorderId === mat.serial ? undefined : (_jsxs(MatCardDetail, { fsize: fsize, children: ["Workorder: ", mat.workorderId] })), mat.jobUnique !== undefined &&
388
+ showRawMaterial &&
389
+ inProcMat &&
390
+ inProcMat.process === 0 ? (_jsx(JobRawMaterial, { fsize: fsize, mat: inProcMat })) : undefined, showJobComment && mat.jobUnique && mat.jobUnique !== "" ? (_jsx(RebookingNoteElipsis, { fsize: fsize, uniq: mat.jobUnique })) : undefined, inProcMat ? (_jsx(MaterialAction, { mat: inProcMat, displayActionForSinglePallet: displayActionForSinglePallet, fsize: fsize })) : undefined, inProcMat?.problem ? (_jsx(MatCardDetail, { fsize: fsize, children: _jsxs(Typography, { variant: "body2", color: "error", sx: { fontWeight: "bold" }, children: ["\u26A0 ", inProcMat.problem] }) })) : undefined, completedMsg] }), _jsxs(Box, { sx: {
389
391
  marginLeft: "4px",
390
392
  display: "flex",
391
393
  flexDirection: "column",
@@ -393,8 +395,8 @@ const MatCard = forwardRef(function MatCard(props, ref) {
393
395
  alignItems: "flex-end",
394
396
  alignSelf: "start",
395
397
  flexShrink: 0,
396
- }, children: [props.mat.serial && props.mat.serial.length >= 1 && !props.hideAvatar ? (_jsx("div", { children: _jsx(Avatar, { style: { width: "30px", height: "30px" }, children: props.mat.serial.slice(-1) }) })) : undefined, props.hideWarningIcon ? undefined : (_jsx("div", { children: _jsx(Warning, { mat: props.mat }) }))] })] }) })] }));
397
- });
398
+ }, children: [mat.serial && mat.serial.length >= 1 && !hideAvatar ? (_jsx("div", { children: _jsx(Avatar, { style: { width: "30px", height: "30px" }, children: mat.serial.slice(-1) }) })) : undefined, hideWarningIcon ? undefined : (_jsx("div", { children: _jsx(Warning, { mat: mat }) }))] })] }) })] }));
399
+ };
398
400
  export const MatSummary = memo(MatCard);
399
401
  export const InProcMaterial = memo(function InProcMaterial(props) {
400
402
  return (_jsx(MatCard, { mat: inproc_mat_to_summary(props.mat), inProcMat: props.mat, displayActionForSinglePallet: props.displayActionForSinglePallet, fsize: props.fsize, hideAvatar: props.hideAvatar, displayJob: props.displayJob, showDragHandle: props.showHandle, hideEmptySerial: props.hideEmptySerial, showRawMaterial: props.showRawMaterial, showJobComment: props.showJobComment, shake: props.shake }));
@@ -89,7 +89,7 @@ function OneJobPerPage(props) {
89
89
  serial2: mats[mats.length - 1]?.serial,
90
90
  },
91
91
  ])
92
- .toSortedArray(([_, p]) => p.part), [props.material, allJobs]);
92
+ .toSortedArray(([, p]) => p.part), [props.material, allJobs]);
93
93
  if (!props.material || props.material.length === 0) {
94
94
  return _jsx("div", {});
95
95
  }
@@ -105,7 +105,7 @@ function CombinedToOnePage(props) {
105
105
  .filter((m) => m.jobUnique !== null && m.jobUnique !== undefined && m.jobUnique !== "")
106
106
  .groupBy((m) => m.jobUnique)
107
107
  .map(([k, mats]) => [k, { length: mats.length, part: mats[0]?.partName ?? "" }])
108
- .toSortedArray(([_, p]) => p.part), [props.material]);
108
+ .toSortedArray(([, p]) => p.part), [props.material]);
109
109
  const allJobs = useAtomValue(currentStatus).jobs;
110
110
  const notes = useMemo(() => LazySeq.of(props.material || [])
111
111
  .collect((m) => (m.jobUnique ? allJobs[m.jobUnique]?.comment : undefined))
@@ -62,7 +62,7 @@ function useQuarantineMaterial() {
62
62
  return null;
63
63
  const quarantineQueue = fmsInfo.quarantineQueue?.length ? fmsInfo.quarantineQueue : null;
64
64
  const activeQueues = LazySeq.ofObject(curSt.jobs)
65
- .flatMap(([_, job]) => job.procsAndPaths)
65
+ .flatMap(([, job]) => job.procsAndPaths)
66
66
  .flatMap((proc) => proc.paths)
67
67
  .flatMap((path) => {
68
68
  const q = [];
@@ -74,11 +74,11 @@ function useQuarantineMaterial() {
74
74
  })
75
75
  .concat(LazySeq.ofObject(curSt.queues)
76
76
  .filter(([, info]) => info.role === QueueRole.RawMaterial || info.role === QueueRole.InProcessTransfer)
77
- .map(([qname, _]) => qname))
77
+ .map(([qname]) => qname))
78
78
  .toRSet((x) => x);
79
79
  const quarantineQueues = LazySeq.ofObject(curSt.queues)
80
- .filter(([qname, _]) => !activeQueues.has(qname))
81
- .toRSet(([qname, _]) => qname);
80
+ .filter(([qname]) => !activeQueues.has(qname))
81
+ .toRSet(([qname]) => qname);
82
82
  // If in a quarantine queue, allow removal from system
83
83
  if (inProcMat.location.type === LocType.InQueue &&
84
84
  inProcMat.location.currentQueue &&
@@ -42,7 +42,7 @@ import { materialDialogOpen } from "../../cell-status/material-details.js";
42
42
  import { last30Jobs } from "../../cell-status/scheduled-jobs.js";
43
43
  import { addDays } from "date-fns";
44
44
  import { durationToSeconds } from "../../util/parseISODuration.js";
45
- import { InvalidateCycleDialogButton, InvalidateCycleDialogContent, SwapMaterialButtons, SwapMaterialDialogContent, } from "./InvalidateCycle.js";
45
+ import { InvalidateCycleDialogButton, InvalidateCycleDialogContent, } from "./InvalidateCycle.js";
46
46
  import { CancelLoadButton } from "./CancelLoadButton.js";
47
47
  import { QuarantineMatButton } from "./QuarantineButton.js";
48
48
  import { SelectInspTypeDialog, SignalInspectionButton } from "./SelectInspType.js";
@@ -68,8 +68,8 @@ function useCellOverview() {
68
68
  m.action.loadToBasketId !== undefined))
69
69
  .toRLookup((m) => m.location.basketId ?? m.action.loadToBasketId ?? 0);
70
70
  let loads = LazySeq.ofObject(currentSt.pallets)
71
- .filter(([_, p]) => p.currentPalletLocation.loc === PalletLocationEnum.LoadUnload)
72
- .toOrderedMap(([_, p]) => [
71
+ .filter(([, p]) => p.currentPalletLocation.loc === PalletLocationEnum.LoadUnload)
72
+ .toOrderedMap(([, p]) => [
73
73
  p.currentPalletLocation.num,
74
74
  {
75
75
  lulNum: p.currentPalletLocation.num,
@@ -82,7 +82,7 @@ function useCellOverview() {
82
82
  let machines = LazySeq.ofObject(currentSt.pallets)
83
83
  .filter(([, p]) => p.currentPalletLocation.loc === PalletLocationEnum.Machine ||
84
84
  p.currentPalletLocation.loc === PalletLocationEnum.MachineQueue)
85
- .map(([_, p]) => p)
85
+ .map(([, p]) => p)
86
86
  .groupBy((p) => p.currentPalletLocation.group, (p) => p.currentPalletLocation.num)
87
87
  .toLookupOrderedMap(([[statGroup, _statNum], _pals]) => statGroup, ([[_statGroup, statNum], _pals]) => statNum, ([[statGroup, statNum], pals]) => {
88
88
  const worktable = pals.find((p) => p.currentPalletLocation.loc === PalletLocationEnum.Machine);
@@ -117,9 +117,9 @@ function useCellOverview() {
117
117
  }
118
118
  });
119
119
  const stockerPals = LazySeq.ofObject(currentSt.pallets)
120
- .filter(([_, p]) => p.currentPalletLocation.loc === PalletLocationEnum.Buffer ||
120
+ .filter(([, p]) => p.currentPalletLocation.loc === PalletLocationEnum.Buffer ||
121
121
  p.currentPalletLocation.loc === PalletLocationEnum.Cart)
122
- .collect(([_, p]) => {
122
+ .collect(([, p]) => {
123
123
  const mats = matByPal.get(p.palletNum);
124
124
  if (!mats || mats.length === 0)
125
125
  return null;
@@ -134,7 +134,7 @@ function useCellOverview() {
134
134
  const allProcs = jobs
135
135
  .valuesToLazySeq()
136
136
  .filter((j) => j.routeEndUTC > cutoff)
137
- .concat(LazySeq.ofObject(currentSt.jobs).map(([_, j]) => j))
137
+ .concat(LazySeq.ofObject(currentSt.jobs).map(([, j]) => j))
138
138
  .flatMap((j) => j.procsAndPaths)
139
139
  .toRArray();
140
140
  for (const proc of allProcs) {
@@ -246,13 +246,18 @@ function useCellOverview() {
246
246
  let storageEmpty = 0;
247
247
  let storageFilled = 0;
248
248
  for (const basket of LazySeq.ofObject(currentSt.baskets ?? {})
249
- .map(([_, b]) => b)
249
+ .map(([, b]) => b)
250
250
  .sortBy((b) => b.basketId)) {
251
251
  const basketWithMaterial = {
252
252
  basket,
253
253
  mats: matByBasket.get(basket.basketId) ?? [],
254
254
  };
255
- switch (basket.position.location) {
255
+ const position = basket.position;
256
+ if (position === undefined) {
257
+ floatingBaskets.set(basket.basketId, basketWithMaterial);
258
+ continue;
259
+ }
260
+ switch (position.location) {
256
261
  case BasketLocationEnum.Storage:
257
262
  if (basketWithMaterial.mats.length > 0) {
258
263
  storageFilled += 1;
@@ -263,14 +268,12 @@ function useCellOverview() {
263
268
  break;
264
269
  case BasketLocationEnum.LoadUnload:
265
270
  case BasketLocationEnum.LoadStationStaging: {
266
- const loadNum = basket.position.locationNum;
271
+ const loadNum = position.locationNum;
267
272
  if (loadNum === null) {
268
273
  floatingBaskets.set(basket.basketId, basketWithMaterial);
269
274
  break;
270
275
  }
271
- const byLoad = basket.position.location === BasketLocationEnum.LoadUnload
272
- ? activeBaskets
273
- : stagedBaskets;
276
+ const byLoad = position.location === BasketLocationEnum.LoadUnload ? activeBaskets : stagedBaskets;
274
277
  const prev = byLoad.get(loadNum) ?? [];
275
278
  prev.push(basketWithMaterial);
276
279
  byLoad.set(loadNum, prev);
@@ -281,8 +284,6 @@ function useCellOverview() {
281
284
  break;
282
285
  }
283
286
  }
284
- let maxNumStagingRows = 0;
285
- let maxNumSourceRows = 0;
286
287
  loads = loads.mapValues((load) => {
287
288
  const sourceRows = new Map();
288
289
  const sourceMats = LazySeq.of(load.pal?.mats ?? load.basket?.mats ?? [])
@@ -320,7 +321,7 @@ function useCellOverview() {
320
321
  }
321
322
  }
322
323
  const currentBasket = LazySeq.of(activeBaskets.get(load.lulNum) ?? [])
323
- .sortBy((b) => b.basket.position.locationNum)
324
+ .sortBy((b) => b.basket.position?.locationNum ?? 0)
324
325
  .toRArray();
325
326
  // Extras beyond the first active basket at this station fall back to floating
326
327
  for (const extra of currentBasket.slice(1)) {
@@ -331,14 +332,12 @@ function useCellOverview() {
331
332
  .toRArray());
332
333
  const staging = LazySeq.of(stagedBaskets.get(load.lulNum) ?? [])
333
334
  .filter((basket) => !loadingFromBasketIds.has(basket.basket.basketId))
334
- .sortBy((b) => b.basket.position.locationNum)
335
+ .sortBy((b) => b.basket.position?.locationNum ?? 0)
335
336
  .toRArray();
336
- maxNumStagingRows = Math.max(maxNumStagingRows, staging.length);
337
337
  const sources = LazySeq.of(sourceRows)
338
338
  .map(([key, row]) => ({ key, label: row.label, mats: row.mats }))
339
339
  .sortBy((row) => row.label)
340
340
  .toRArray();
341
- maxNumSourceRows = Math.max(maxNumSourceRows, sources.length);
342
341
  return {
343
342
  ...load,
344
343
  basket: currentBasket[0] ?? null,
@@ -354,15 +353,20 @@ function useCellOverview() {
354
353
  storageBaskets: storageEmpty + storageFilled > 0 ? { empty: storageEmpty, filled: storageFilled } : null,
355
354
  machineAtLoad: machAtLoad.valuesToAscLazySeq().toRArray(),
356
355
  maxNumFacesOnPallet,
357
- maxNumStagingRows,
358
- maxNumSourceRows,
356
+ maxNumStagingRows: loads
357
+ .valuesToAscLazySeq()
358
+ .map((l) => l.staging.length)
359
+ .maxBy((l) => l) ?? 0,
360
+ maxNumSourceRows: loads
361
+ .valuesToAscLazySeq()
362
+ .map((l) => l.sources.length)
363
+ .maxBy((l) => l) ?? 0,
359
364
  };
360
365
  }
361
366
  function MaterialIcon({ mats }) {
362
367
  const [open, setOpen] = useState(false);
363
368
  const closeTimeout = useRef(null);
364
- const btnRef = useRef(null);
365
- const [menuOpen, setMenuOpen] = useState(false);
369
+ const [menuAnchorEl, setMenuAnchorEl] = useState(null);
366
370
  const setMatToShow = useSetAtom(materialDialogOpen);
367
371
  const curSt = useAtomValue(currentStatus);
368
372
  function enter() {
@@ -378,12 +382,12 @@ function MaterialIcon({ mats }) {
378
382
  closeTimeout.current = null;
379
383
  }, 200);
380
384
  }
381
- function click() {
385
+ function click(evt) {
382
386
  if (mats.length === 1) {
383
387
  setMatToShow({ type: "MatDetails", details: mats[0] });
384
388
  }
385
389
  else {
386
- setMenuOpen(true);
390
+ setMenuAnchorEl(evt.currentTarget);
387
391
  }
388
392
  }
389
393
  function faceName(pallet, faceNum) {
@@ -399,7 +403,7 @@ function MaterialIcon({ mats }) {
399
403
  zIndex: open ? 10 : 0,
400
404
  width: "max-content",
401
405
  height: "max-content",
402
- }, children: _jsx(Badge, { badgeContent: mats.length > 1 ? mats.length : 0, color: "secondary", children: _jsx(ButtonBase, { focusRipple: true, onClick: click, ref: btnRef, children: _jsx(Collapse, { orientation: "horizontal", in: open, collapsedSize: CollapsedIconSize, children: _jsxs(Box, { sx: {
406
+ }, children: _jsx(Badge, { badgeContent: mats.length > 1 ? mats.length : 0, color: "secondary", children: _jsx(ButtonBase, { focusRipple: true, onClick: click, children: _jsx(Collapse, { orientation: "horizontal", in: open, collapsedSize: CollapsedIconSize, children: _jsxs(Box, { sx: {
403
407
  display: "flex",
404
408
  }, children: [_jsx(PartIdenticon, { part: mats[0].partName, size: CollapsedIconSize }), _jsx(Box, { sx: {
405
409
  marginLeft: "10px",
@@ -409,8 +413,8 @@ function MaterialIcon({ mats }) {
409
413
  }, children: _jsx(Collapse, { in: open, collapsedSize: CollapsedIconSize, children: _jsxs(Stack, { direction: "column", sx: {
410
414
  marginBottom: "0.2em",
411
415
  }, children: [_jsxs(Typography, { variant: "h6", children: [mats[0].partName, "-", mats[0].process] }), _jsx("div", { children: _jsx("small", { children: faceName(mats[0].location.palletNum, mats[0].location.face) ??
412
- faceName(mats[0].action.loadOntoPalletNum, mats[0].action.loadOntoFace) }) }), LazySeq.of(mats).collect((mat) => mat.serial ? (_jsx("div", { children: _jsxs("small", { children: ["Serial: ", mat.serial] }) }, mat.materialID)) : undefined), _jsx("div", { children: _jsx(MaterialAction, { mat: mats[0] }) })] }) }) })] }) }) }) }) }), _jsx(Menu, { anchorEl: btnRef.current, open: menuOpen, onClose: () => setMenuOpen(false), anchorOrigin: { vertical: "top", horizontal: "left" }, children: LazySeq.of(mats).map((mat, idx) => (_jsx(MenuItem, { onClick: () => {
413
- setMenuOpen(false);
416
+ faceName(mats[0].action.loadOntoPalletNum, mats[0].action.loadOntoFace) }) }), LazySeq.of(mats).collect((mat) => mat.serial ? (_jsx("div", { children: _jsxs("small", { children: ["Serial: ", mat.serial] }) }, mat.materialID)) : undefined), _jsx("div", { children: _jsx(MaterialAction, { mat: mats[0] }) })] }) }) })] }) }) }) }) }), _jsx(Menu, { anchorEl: menuAnchorEl, open: Boolean(menuAnchorEl), onClose: () => setMenuAnchorEl(null), anchorOrigin: { vertical: "top", horizontal: "left" }, children: LazySeq.of(mats).map((mat, idx) => (_jsx(MenuItem, { onClick: () => {
417
+ setMenuAnchorEl(null);
414
418
  setMatToShow({ type: "MatDetails", details: mat });
415
419
  }, children: mat.serial && mat.serial !== "" ? mat.serial : (idx + 1).toString() }, mat.materialID))) })] }));
416
420
  }
@@ -820,13 +824,11 @@ export const SystemOverview = memo(function SystemOverview({ overview, }) {
820
824
  }, children: [overview.stockerPals.map((pal) => (_jsx(StockerPallet, { pallet: pal, maxNumFaces: overview.maxNumFacesOnPallet }, pal.pallet.palletNum))), overview.floatingBaskets.map((basket) => (_jsx(FloatingBasket, { basket: basket }, basket.basket.basketId))), overview.storageBaskets ? (_jsx(BasketStorageSummary, { empty: overview.storageBaskets.empty, filled: overview.storageBaskets.filled })) : undefined] })) : undefined] }));
821
825
  });
822
826
  const SystemOverviewMaterialDialog = memo(function SystemOverviewMaterialDialog({ ignoreOperator, }) {
823
- const [swapSt, setSwapSt] = useState(null);
824
827
  const [invalidateSt, setInvalidateSt] = useState(null);
825
828
  function onClose() {
826
- setSwapSt(null);
827
829
  setInvalidateSt(null);
828
830
  }
829
- return (_jsx(MaterialDialog, { onClose: onClose, allowNote: true, highlightProcsGreaterOrEqualTo: invalidateSt?.process ?? undefined, extraDialogElements: _jsxs(_Fragment, { children: [_jsx(SwapMaterialDialogContent, { st: swapSt, setState: setSwapSt }), invalidateSt !== null ? (_jsx(InvalidateCycleDialogContent, { st: invalidateSt, setState: setInvalidateSt })) : null] }), buttons: _jsxs(_Fragment, { children: [_jsx(QuarantineMatButton, { ignoreOperator: ignoreOperator }), _jsx(CancelLoadButton, { onClose: onClose, ignoreOperator: ignoreOperator }), _jsx(SignalInspectionButton, {}), _jsx(SwapMaterialButtons, { st: swapSt, setState: setSwapSt, onClose: onClose, ignoreOperator: ignoreOperator }), _jsx(InvalidateCycleDialogButton, { st: invalidateSt, setState: setInvalidateSt, onClose: onClose, ignoreOperator: ignoreOperator })] }) }));
831
+ return (_jsx(MaterialDialog, { onClose: onClose, allowNote: true, highlightProcsGreaterOrEqualTo: invalidateSt?.process ?? undefined, extraDialogElements: _jsx(_Fragment, { children: invalidateSt !== null ? (_jsx(InvalidateCycleDialogContent, { st: invalidateSt, setState: setInvalidateSt })) : null }), buttons: _jsxs(_Fragment, { children: [_jsx(QuarantineMatButton, { ignoreOperator: ignoreOperator }), _jsx(CancelLoadButton, { onClose: onClose, ignoreOperator: ignoreOperator }), _jsx(SignalInspectionButton, {}), _jsx(InvalidateCycleDialogButton, { st: invalidateSt, setState: setInvalidateSt, onClose: onClose, ignoreOperator: ignoreOperator })] }) }));
830
832
  });
831
833
  export function SystemOverviewPage({ ignoreOperator, whiteBackground, }) {
832
834
  useSetTitle("System Overview");
@@ -62,15 +62,18 @@ export var MaterialBinType;
62
62
  MaterialBinType["QuarantineQueues"] = "Bin_Quarantine";
63
63
  })(MaterialBinType || (MaterialBinType = {}));
64
64
  function basketLocation(st) {
65
+ const position = st.position;
66
+ if (position === undefined)
67
+ return "Unknown";
65
68
  let loc;
66
- if (st.position.locationTitle && st.position.locationTitle.length > 0) {
67
- loc = st.position.locationTitle;
69
+ if (position.locationTitle && position.locationTitle.length > 0) {
70
+ loc = position.locationTitle;
68
71
  }
69
72
  else {
70
- loc = st.position.location + " " + st.position.locationNum.toString();
73
+ loc = position.location + " " + position.locationNum.toString();
71
74
  }
72
- if (st.position.zone) {
73
- loc += `-${st.position.zone}`;
75
+ if (position.zone) {
76
+ loc += `-${position.zone}`;
74
77
  }
75
78
  return loc;
76
79
  }
@@ -128,8 +131,9 @@ export function selectAllMaterialIntoBins(curSt, curBinOrder) {
128
131
  }
129
132
  case api.ActionType.LoadingToBasket: {
130
133
  const basket = curSt.baskets?.[mat.action.loadToBasketId ?? 0];
131
- if (basket?.position.location === api.BasketLocationEnum.LoadUnload) {
132
- addToMap(loadStations, basket.position.locationNum, mat);
134
+ const position = basket?.position;
135
+ if (position?.location === api.BasketLocationEnum.LoadUnload) {
136
+ addToMap(loadStations, position.locationNum, mat);
133
137
  }
134
138
  else {
135
139
  addToMap(queues, "Free Material", mat);
@@ -149,7 +153,7 @@ export function selectAllMaterialIntoBins(curSt, curBinOrder) {
149
153
  }
150
154
  }
151
155
  const activeQueues = LazySeq.ofObject(curSt.jobs)
152
- .flatMap(([_, job]) => job.procsAndPaths)
156
+ .flatMap(([, job]) => job.procsAndPaths)
153
157
  .flatMap((proc) => proc.paths)
154
158
  .flatMap((path) => {
155
159
  const q = [];
@@ -162,11 +166,11 @@ export function selectAllMaterialIntoBins(curSt, curBinOrder) {
162
166
  .concat(LazySeq.ofObject(curSt.queues)
163
167
  .filter(([, info]) => info.role === api.QueueRole.RawMaterial ||
164
168
  info.role === api.QueueRole.InProcessTransfer)
165
- .map(([qname, _]) => qname))
169
+ .map(([qname]) => qname))
166
170
  .toRSet((x) => x);
167
171
  const quarantineQueues = LazySeq.ofObject(curSt.queues)
168
- .filter(([qname, _]) => !activeQueues.has(qname))
169
- .toRSet(([qname, _]) => qname);
172
+ .filter(([qname]) => !activeQueues.has(qname))
173
+ .toRSet(([qname]) => qname);
170
174
  const bins = curBinOrder.filter((b) => b === LoadStationBinId ||
171
175
  b === PalletsBinId ||
172
176
  b === ActiveQueuesBinId ||
@@ -39,9 +39,12 @@ import { durationToMinutes, durationToSeconds } from "../util/parseISODuration.j
39
39
  function basketsAtLoad(currentSt) {
40
40
  return LazySeq.ofObject(currentSt.baskets ?? {})
41
41
  .collect(([, basket]) => {
42
- if (basket.position.location === BasketLocationEnum.LoadUnload ||
43
- basket.position.location === BasketLocationEnum.LoadStationStaging) {
44
- return [basket.basketId, { group: "L/U", num: basket.position.locationNum }];
42
+ const position = basket.position;
43
+ if (position === undefined)
44
+ return null;
45
+ if (position.location === BasketLocationEnum.LoadUnload ||
46
+ position.location === BasketLocationEnum.LoadStationStaging) {
47
+ return [basket.basketId, { group: "L/U", num: position.locationNum }];
45
48
  }
46
49
  return null;
47
50
  })
@@ -129,7 +129,7 @@ export function inspectionDataToSankey(d) {
129
129
  }))
130
130
  .toMutableArray();
131
131
  // create a map from NodeR to index
132
- const nodesToIdx = nodes.toHashMap((n) => [n.node, n.idx], (i1, _) => i1);
132
+ const nodesToIdx = nodes.toHashMap((n) => [n.node, n.idx], (i1) => i1);
133
133
  // create the sankey links to return by counting Edges between nodes
134
134
  const sankeyLinks = edges
135
135
  .toHashMap((e) => [e, 1], (c1, c2) => c1 + c2)
@@ -97,7 +97,7 @@ export function binCyclesByDayAndPart(cycles, matsById, start, end) {
97
97
  .toHashMap((p) => [new MatIdAndProcess(p.matId, p.proc), p.active], (a1, a2) => a1 + a2);
98
98
  return LazySeq.of(matsById)
99
99
  .flatMap(([matId, details]) => LazySeq.ofObject(details.unloaded_processes ?? {})
100
- .filter(([_, unloadTime]) => unloadTime >= start && unloadTime <= end)
100
+ .filter(([, unloadTime]) => unloadTime >= start && unloadTime <= end)
101
101
  .map(([proc, unloadTime]) => ({
102
102
  day: startOfDay(unloadTime),
103
103
  part: details.partName + "-" + proc,
@@ -304,7 +304,7 @@ export function buildCycleTable(cycles, matsById, startD, endD, hideMedian, load
304
304
  }
305
305
  table += "</tr></thead>\n<tbody>\n";
306
306
  const filteredCycles = LazySeq.of(cycles.data)
307
- .flatMap(([_, c]) => c)
307
+ .flatMap(([, c]) => c)
308
308
  .filter((p) => (!startD || p.endTime >= startD) && (!endD || p.endTime < endD))
309
309
  .toSortedArray((a) => a.endTime.getTime());
310
310
  for (const cycle of filteredCycles) {
@@ -34,7 +34,7 @@ import copy from "copy-to-clipboard";
34
34
  import { LazySeq } from "@seedtactics/immutable-collections";
35
35
  export function buildScheduledJobs(zoom, matIds, schJobs, currentSt) {
36
36
  const completedMats = LazySeq.of(matIds)
37
- .flatMap(([matId, summary]) => LazySeq.ofObject(summary.unloaded_processes ?? {}).map(([proc, _]) => ({
37
+ .flatMap(([matId, summary]) => LazySeq.ofObject(summary.unloaded_processes ?? {}).map(([proc]) => ({
38
38
  matId: matId,
39
39
  proc: parseInt(proc),
40
40
  uniq: summary.jobUnique,
package/dist/index.html CHANGED
@@ -43,7 +43,7 @@
43
43
  }
44
44
  }
45
45
  </style>
46
- <script type="module" crossorigin src="/assets/index-C4HZdhRu.js"></script>
46
+ <script type="module" crossorigin src="/assets/index-BaeSfExJ.js"></script>
47
47
  <link rel="stylesheet" crossorigin href="/assets/index-DXfAwuj-.css">
48
48
  </head>
49
49
  <body>