@seedtactics/insight-client 17.0.1-beta.8 → 17.0.1
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.
- package/README.md +16 -4
- package/dist/assets/ProgramHighlight-mKbZxoXO.js +3 -0
- package/dist/assets/index-CfHZxY5F.js +367 -0
- package/dist/cell-status/current-status.d.ts +1 -0
- package/dist/cell-status/current-status.js +2 -0
- package/dist/cell-status/loading.d.ts +13 -0
- package/dist/cell-status/loading.js +36 -3
- package/dist/cell-status/material-details.d.ts +2 -2
- package/dist/cell-status/material-details.js +33 -14
- package/dist/components/App.d.ts +0 -5
- package/dist/components/App.js +1 -1
- package/dist/components/ChooseMode.js +15 -3
- package/dist/components/ErrorsAndLoading.js +2 -1
- package/dist/components/LoadingIcon.js +3 -1
- package/dist/components/analysis/BufferChart.js +3 -2
- package/dist/components/operations/AllMaterial.js +9 -12
- package/dist/components/operations/RecentCycleChart.js +16 -21
- package/dist/components/quality/QualityMaterial.js +3 -12
- package/dist/components/station-monitor/BasketLoadStationWork.d.ts +4 -7
- package/dist/components/station-monitor/BasketLoadStationWork.js +79 -44
- package/dist/components/station-monitor/CancelLoadButton.js +8 -3
- package/dist/components/station-monitor/InvalidateCycle.js +26 -25
- package/dist/components/station-monitor/LoadStation.d.ts +0 -5
- package/dist/components/station-monitor/LoadStation.js +88 -115
- package/dist/components/station-monitor/Material.d.ts +6 -1
- package/dist/components/station-monitor/Material.js +22 -9
- package/dist/components/station-monitor/MoveMaterialArrows.js +9 -0
- package/dist/components/station-monitor/PrintedLabel.js +15 -19
- package/dist/components/station-monitor/QuarantineButton.js +21 -29
- package/dist/components/station-monitor/QueuesAddMaterial.js +2 -5
- package/dist/components/station-monitor/SystemOverview.js +59 -19
- package/dist/components/station-monitor/Whiteboard.js +14 -15
- package/dist/data/material-operation-policy.d.ts +6 -0
- package/dist/data/material-operation-policy.js +26 -2
- package/dist/data/move-arrows.d.ts +7 -0
- package/dist/data/move-arrows.js +107 -24
- package/dist/data/queue-material.d.ts +1 -0
- package/dist/data/queue-material.js +55 -48
- package/dist/extension.d.ts +1 -1
- package/dist/extension.js +1 -0
- package/dist/index.html +2 -39
- package/dist/index.js +1 -6
- package/dist/network/api-errors.d.ts +8 -0
- package/dist/network/api-errors.js +77 -0
- package/dist/network/api.d.ts +18 -34
- package/dist/network/api.js +66 -64
- package/dist/network/backend-mock.js +3 -0
- package/dist/network/backend.d.ts +1 -0
- package/dist/network/websocket.d.ts +1 -0
- package/dist/network/websocket.js +124 -36
- package/dist/util/parseISODuration.js +10 -9
- package/docs/material-quarantine.md +5 -4
- package/docs/mazak.md +11 -14
- package/docs/operator-procedures.md +14 -0
- package/docs/server-config.md +20 -12
- package/package.json +25 -20
- package/dist/assets/ProgramHighlight-C6zSEXCX.js +0 -3
- package/dist/assets/index-MFZreX-b.js +0 -388
- package/dist/components/station-monitor/BasketMovementArrival.d.ts +0 -40
- package/dist/components/station-monitor/BasketMovementArrival.js +0 -165
|
@@ -37,18 +37,20 @@ import { LazySeq } from "@seedtactics/immutable-collections";
|
|
|
37
37
|
import { currentStatus } from "../../cell-status/current-status.js";
|
|
38
38
|
import { inProcessMaterialInDialog, materialDialogOpen, useQuarantineQueuedMaterial, useRemoveFromQueue, useSignalForQuarantine, } from "../../cell-status/material-details.js";
|
|
39
39
|
import { currentOperator } from "../../data/operators.js";
|
|
40
|
-
import {
|
|
40
|
+
import { LocType, QueueRole } from "../../network/api.js";
|
|
41
|
+
import { apiErrorMessage } from "../../network/api-errors.js";
|
|
41
42
|
import { fmsInformation } from "../../network/server-settings.js";
|
|
42
43
|
import { useAtomValue, useSetAtom } from "jotai";
|
|
43
|
-
import { canDirectlyQuarantine, canRemoveFromQueue, canSignalQuarantine,
|
|
44
|
+
import { canDirectlyQuarantine, canRemoveFromQueue, canSignalQuarantine, quarantineRoute, } from "../../data/material-operation-policy.js";
|
|
44
45
|
function hasSupportedQuarantineExit(material, status) {
|
|
45
46
|
const job = status.jobs[material.jobUnique];
|
|
46
47
|
if (!job)
|
|
47
48
|
return false;
|
|
48
|
-
const
|
|
49
|
+
const route = quarantineRoute(material);
|
|
50
|
+
const path = job.procsAndPaths[route.process - 1]?.paths[route.path - 1];
|
|
49
51
|
if (!path)
|
|
50
52
|
return false;
|
|
51
|
-
return
|
|
53
|
+
return route.process === job.procsAndPaths.length || Boolean(path.outputQueue);
|
|
52
54
|
}
|
|
53
55
|
function useQuarantineMaterial() {
|
|
54
56
|
const fmsInfo = useAtomValue(fmsInformation);
|
|
@@ -56,8 +58,6 @@ function useQuarantineMaterial() {
|
|
|
56
58
|
const curSt = useAtomValue(currentStatus);
|
|
57
59
|
if (inProcMat === null || inProcMat.materialID < 0)
|
|
58
60
|
return null;
|
|
59
|
-
if (isActiveLoadStationOperation(inProcMat))
|
|
60
|
-
return null;
|
|
61
61
|
if (inProcMat.quarantineAfterUnload)
|
|
62
62
|
return null;
|
|
63
63
|
const quarantineQueue = fmsInfo.quarantineQueue?.length ? fmsInfo.quarantineQueue : null;
|
|
@@ -80,7 +80,8 @@ function useQuarantineMaterial() {
|
|
|
80
80
|
.filter(([qname]) => !activeQueues.has(qname))
|
|
81
81
|
.toRSet(([qname]) => qname);
|
|
82
82
|
// If in a quarantine queue, allow removal from system
|
|
83
|
-
if (inProcMat
|
|
83
|
+
if (canRemoveFromQueue(inProcMat) &&
|
|
84
|
+
inProcMat.location.type === LocType.InQueue &&
|
|
84
85
|
inProcMat.location.currentQueue &&
|
|
85
86
|
quarantineQueues.has(inProcMat.location.currentQueue)) {
|
|
86
87
|
return {
|
|
@@ -91,25 +92,16 @@ function useQuarantineMaterial() {
|
|
|
91
92
|
};
|
|
92
93
|
}
|
|
93
94
|
let type = null;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
case LocType.InQueue:
|
|
103
|
-
if (!canDirectlyQuarantine(inProcMat))
|
|
104
|
-
return null;
|
|
105
|
-
if (inProcMat.location.currentQueue === undefined ||
|
|
106
|
-
quarantineQueues.has(inProcMat.location.currentQueue)) {
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
type = "Scrap";
|
|
110
|
-
break;
|
|
111
|
-
case LocType.Free:
|
|
95
|
+
if (canSignalQuarantine(inProcMat)) {
|
|
96
|
+
if (!hasSupportedQuarantineExit(inProcMat, curSt))
|
|
97
|
+
return null;
|
|
98
|
+
type = "SignalForScrap";
|
|
99
|
+
}
|
|
100
|
+
else if (canDirectlyQuarantine(inProcMat)) {
|
|
101
|
+
if (inProcMat.location.currentQueue === undefined ||
|
|
102
|
+
quarantineQueues.has(inProcMat.location.currentQueue))
|
|
112
103
|
return null;
|
|
104
|
+
type = "Scrap";
|
|
113
105
|
}
|
|
114
106
|
if (type) {
|
|
115
107
|
return {
|
|
@@ -145,7 +137,7 @@ function RemoveFromQueuesButton({ material, removeFromQueues, removing, }) {
|
|
|
145
137
|
});
|
|
146
138
|
}
|
|
147
139
|
catch (e) {
|
|
148
|
-
setError(
|
|
140
|
+
setError(apiErrorMessage(e));
|
|
149
141
|
}
|
|
150
142
|
}
|
|
151
143
|
function openRemoval() {
|
|
@@ -214,7 +206,7 @@ export function QuarantineMatButton({ onClose, ignoreOperator, }) {
|
|
|
214
206
|
title = displayedSnapshot.destination
|
|
215
207
|
? `The current automated operation will continue. When the material leaves automation control, move it to ${displayedSnapshot.destination}`
|
|
216
208
|
: "The current automated operation will continue. When the material leaves automation control, remove it from normal production flow as scrap";
|
|
217
|
-
btnTxt = displayedSnapshot.destination ? "
|
|
209
|
+
btnTxt = displayedSnapshot.destination ? "Signal for quarantine" : "Scrap";
|
|
218
210
|
break;
|
|
219
211
|
}
|
|
220
212
|
async function quarantine() {
|
|
@@ -253,7 +245,7 @@ export function QuarantineMatButton({ onClose, ignoreOperator, }) {
|
|
|
253
245
|
}
|
|
254
246
|
}
|
|
255
247
|
catch (e) {
|
|
256
|
-
setError(
|
|
248
|
+
setError(apiErrorMessage(e));
|
|
257
249
|
}
|
|
258
250
|
finally {
|
|
259
251
|
setUpdating(false);
|
|
@@ -266,5 +258,5 @@ export function QuarantineMatButton({ onClose, ignoreOperator, }) {
|
|
|
266
258
|
? quarantiningQueued
|
|
267
259
|
: removingFromQueue);
|
|
268
260
|
const removeFromQueues = q?.canRemoveFromQueues === true ? () => removeFromQueue(q.material.materialID, operator) : null;
|
|
269
|
-
return (_jsxs(_Fragment, { children: [q ? (_jsx(Tooltip, { title: title, children: _jsx(Button, { color: "primary", disabled: removing, onClick: openQuarantine, children: btnTxt }) })) : null, removeFromQueues && q ? (_jsx(RemoveFromQueuesButton, { material: q.material, removeFromQueues: removeFromQueues, removing: removingFromQueue })) : null, _jsxs(Dialog, { open: open && snapshot !== null, onClose: closeQuarantine, children: [_jsx(DialogTitle, { children: "Quarantine Material" }), _jsxs(DialogContent, { children: [_jsx("p", { children: title }), _jsx(TextField, { label: "Reason", value: reason, onChange: (e) => setReason(e.target.value), fullWidth: true, autoFocus: true, multiline: true }), error ? _jsx("p", { role: "alert", children: error }) : null] }), _jsxs(DialogActions, { children: [_jsx(Button, { color: "primary", disabled: removing, onClick: quarantine, children: btnTxt }), _jsx(Button, { color: "secondary", disabled: removing, onClick: closeQuarantine, children: "Cancel" })] })] })] }));
|
|
261
|
+
return (_jsxs(_Fragment, { children: [q ? (_jsx(Tooltip, { title: title, describeChild: displayedSnapshot.operation === "DeferredQuarantine", children: _jsx(Button, { color: "primary", disabled: removing, onClick: openQuarantine, children: btnTxt }) })) : null, removeFromQueues && q ? (_jsx(RemoveFromQueuesButton, { material: q.material, removeFromQueues: removeFromQueues, removing: removingFromQueue })) : null, _jsxs(Dialog, { open: open && snapshot !== null, onClose: closeQuarantine, children: [_jsx(DialogTitle, { children: "Quarantine Material" }), _jsxs(DialogContent, { children: [_jsx("p", { children: title }), _jsx(TextField, { label: "Reason", value: reason, onChange: (e) => setReason(e.target.value), fullWidth: true, autoFocus: true, multiline: true }), error ? _jsx("p", { role: "alert", children: error }) : null] }), _jsxs(DialogActions, { children: [_jsx(Button, { color: "primary", disabled: removing, onClick: quarantine, children: btnTxt }), _jsx(Button, { color: "secondary", disabled: removing, onClick: closeQuarantine, children: "Cancel" })] })] })] }));
|
|
270
262
|
}
|
|
@@ -36,6 +36,7 @@ import { Button, Collapse, List, ListItem, ListItemButton, ListItemIcon, ListIte
|
|
|
36
36
|
import { ExpandMore as ExpandMoreIcon } from "@mui/icons-material";
|
|
37
37
|
import { PartIdenticon, WorkorderFromBarcode } from "./Material.js";
|
|
38
38
|
import * as api from "../../network/api.js";
|
|
39
|
+
import { apiErrorMessage } from "../../network/api-errors.js";
|
|
39
40
|
import * as matDetails from "../../cell-status/material-details.js";
|
|
40
41
|
import { usePossibleNewMaterialTypes, } from "../../data/queue-material.js";
|
|
41
42
|
import { currentOperator } from "../../data/operators.js";
|
|
@@ -262,11 +263,7 @@ export function AddToQueueButton({ st: { enteredOperator, newMaterialTy, toQueue
|
|
|
262
263
|
onClose();
|
|
263
264
|
}
|
|
264
265
|
catch (e) {
|
|
265
|
-
setAddError(
|
|
266
|
-
? e.response
|
|
267
|
-
: e instanceof Error
|
|
268
|
-
? e.message
|
|
269
|
-
: String(e));
|
|
266
|
+
setAddError(apiErrorMessage(e));
|
|
270
267
|
}
|
|
271
268
|
}, children: toQueue === null ? ("Add to Queue") : (_jsxs("span", { children: [curQueue !== null ? `Move From ${curQueue} To` : "Add To", " ", toQueue, withSerialMsg, addProcMsg] })) }) }) }), addError ? _jsx("p", { role: "alert", children: addError }) : null] }));
|
|
272
269
|
}
|
|
@@ -36,7 +36,7 @@ import { Paper, ButtonBase, Box, Typography, Collapse, Stack, Menu, MenuItem, Li
|
|
|
36
36
|
import { Close as CloseIcon } from "@mui/icons-material";
|
|
37
37
|
import { InProcMaterial, MaterialAction, MaterialDialog, PartIdenticon } from "./Material.js";
|
|
38
38
|
import { ActionType, BasketLocationEnum, LocType, PalletLocationEnum, } from "../../network/api.js";
|
|
39
|
-
import { currentStatus, secondsSinceEpochAtom } from "../../cell-status/current-status.js";
|
|
39
|
+
import { currentStatus, secondsSinceEpochAtom, minutesSinceEpochAtom, } from "../../cell-status/current-status.js";
|
|
40
40
|
import { LazySeq, OrderedMap } from "@seedtactics/immutable-collections";
|
|
41
41
|
import { materialDialogOpen } from "../../cell-status/material-details.js";
|
|
42
42
|
import { last30Jobs } from "../../cell-status/scheduled-jobs.js";
|
|
@@ -53,6 +53,7 @@ import { basketDisplayName, loadStationDisplayName } from "../../cell-status/sta
|
|
|
53
53
|
const CollapsedIconSize = 45;
|
|
54
54
|
const rowSize = CollapsedIconSize + 10; // each material row has 5px above and 5px below for padding
|
|
55
55
|
function useCellOverview() {
|
|
56
|
+
const minutes = useAtomValue(minutesSinceEpochAtom);
|
|
56
57
|
const currentSt = useAtomValue(currentStatus);
|
|
57
58
|
const jobs = useAtomValue(last30Jobs);
|
|
58
59
|
const fmsInfo = useAtomValue(fmsInformation);
|
|
@@ -128,7 +129,7 @@ function useCellOverview() {
|
|
|
128
129
|
.toOrderedMap((p) => [p.pallet.palletNum, p]);
|
|
129
130
|
let maxLoadNum = 1;
|
|
130
131
|
let maxNumFacesOnPallet = 1;
|
|
131
|
-
const cutoff = addDays(new Date(), -7);
|
|
132
|
+
const cutoff = addDays(new Date(minutes * 60000), -7);
|
|
132
133
|
// now add empty locations
|
|
133
134
|
// Materialize ProcessInfo so we can iterate it at two levels (proc for basket stations, paths for the rest)
|
|
134
135
|
const allProcs = jobs
|
|
@@ -169,7 +170,18 @@ function useCellOverview() {
|
|
|
169
170
|
});
|
|
170
171
|
}
|
|
171
172
|
}
|
|
172
|
-
|
|
173
|
+
// Sites which name their load stations show exactly those plus any station with a basket (stations
|
|
174
|
+
// with a pallet are already present); otherwise show every station up to the largest a job uses.
|
|
175
|
+
const namedLoads = LazySeq.ofObject(fmsInfo.loadStationNames ?? {})
|
|
176
|
+
.map(([num]) => parseInt(num))
|
|
177
|
+
.toRArray();
|
|
178
|
+
const emptyLoads = namedLoads.length > 0
|
|
179
|
+
? LazySeq.of(namedLoads).concat(LazySeq.ofObject(currentSt.baskets ?? {}).collect(([, b]) => b.position?.location === BasketLocationEnum.LoadUnload ||
|
|
180
|
+
b.position?.location === BasketLocationEnum.LoadStationStaging
|
|
181
|
+
? (b.position.locationNum ?? null)
|
|
182
|
+
: null))
|
|
183
|
+
: LazySeq.ofRange(1, maxLoadNum + 1);
|
|
184
|
+
for (const i of emptyLoads) {
|
|
173
185
|
loads = loads.alter(i, (status) => {
|
|
174
186
|
if (status)
|
|
175
187
|
return status;
|
|
@@ -189,6 +201,16 @@ function useCellOverview() {
|
|
|
189
201
|
if (mat.location.face !== null && mat.location.face !== undefined) {
|
|
190
202
|
maxNumFacesOnPallet = Math.max(maxNumFacesOnPallet, mat.location.face);
|
|
191
203
|
}
|
|
204
|
+
if (mat.location.type === LocType.InBasket && mat.location.basketSlot !== undefined) {
|
|
205
|
+
maxNumFacesOnPallet = Math.max(maxNumFacesOnPallet, mat.location.basketSlot);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
// a basket at a load station shows its slots side by side, like the faces of a pallet
|
|
209
|
+
for (const basket of Object.values(currentSt.baskets ?? {})) {
|
|
210
|
+
if (basket.position?.location === BasketLocationEnum.LoadUnload ||
|
|
211
|
+
basket.position?.location === BasketLocationEnum.LoadStationStaging) {
|
|
212
|
+
maxNumFacesOnPallet = Math.max(maxNumFacesOnPallet, basket.slotCount ?? 1, ...(basket.emptySlots ?? []), ...(basket.unknownSlots ?? []));
|
|
213
|
+
}
|
|
192
214
|
}
|
|
193
215
|
let machAtLoad = OrderedMap.empty();
|
|
194
216
|
if (currentSt.machineLocations && currentSt.machineLocations.length > 0) {
|
|
@@ -285,9 +307,19 @@ function useCellOverview() {
|
|
|
285
307
|
}
|
|
286
308
|
}
|
|
287
309
|
loads = loads.mapValues((load) => {
|
|
310
|
+
const currentBasket = LazySeq.of(activeBaskets.get(load.lulNum) ?? [])
|
|
311
|
+
.sortBy((b) => b.basket.position?.locationNum ?? 0)
|
|
312
|
+
.toRArray();
|
|
313
|
+
// Extras beyond the first active basket at this station fall back to floating
|
|
314
|
+
for (const extra of currentBasket.slice(1)) {
|
|
315
|
+
floatingBaskets.set(extra.basket.basketId, extra);
|
|
316
|
+
}
|
|
317
|
+
const currentBasketId = currentBasket[0]?.basket.basketId;
|
|
288
318
|
const sourceRows = new Map();
|
|
289
|
-
|
|
290
|
-
|
|
319
|
+
// material arriving from elsewhere, not already on the pallet or in the basket
|
|
320
|
+
const sourceMats = LazySeq.of(load.pal?.mats ?? currentBasket[0]?.mats ?? [])
|
|
321
|
+
.filter((mat) => mat.location.type !== LocType.OnPallet &&
|
|
322
|
+
!(mat.location.type === LocType.InBasket && mat.location.basketId === currentBasketId))
|
|
291
323
|
.toRArray();
|
|
292
324
|
for (const mat of sourceMats) {
|
|
293
325
|
if (mat.location.type === LocType.Free) {
|
|
@@ -320,13 +352,6 @@ function useCellOverview() {
|
|
|
320
352
|
sourceRows.set(key, row);
|
|
321
353
|
}
|
|
322
354
|
}
|
|
323
|
-
const currentBasket = LazySeq.of(activeBaskets.get(load.lulNum) ?? [])
|
|
324
|
-
.sortBy((b) => b.basket.position?.locationNum ?? 0)
|
|
325
|
-
.toRArray();
|
|
326
|
-
// Extras beyond the first active basket at this station fall back to floating
|
|
327
|
-
for (const extra of currentBasket.slice(1)) {
|
|
328
|
-
floatingBaskets.set(extra.basket.basketId, extra);
|
|
329
|
-
}
|
|
330
355
|
const loadingFromBasketIds = new Set(LazySeq.of(load.pal?.mats ?? [])
|
|
331
356
|
.collect((mat) => mat.action.loadFromBasketId ?? null)
|
|
332
357
|
.toRArray());
|
|
@@ -430,7 +455,7 @@ function PalletFaces({ maxNumFaces, mats: allMats, loadingOntoPallet, noFilter,
|
|
|
430
455
|
const byFace = loadingOntoPallet
|
|
431
456
|
? LazySeq.of(allMats)
|
|
432
457
|
.filter((m) => noFilter || m.location.type !== LocType.OnPallet)
|
|
433
|
-
.orderedGroupBy((m) => m.action.loadOntoFace ?? 1)
|
|
458
|
+
.orderedGroupBy((m) => m.action.loadOntoFace ?? m.action.loadToBasketSlot ?? 1)
|
|
434
459
|
: LazySeq.of(allMats)
|
|
435
460
|
.filter((m) => noFilter || m.location.type === LocType.OnPallet)
|
|
436
461
|
.orderedGroupBy((m) => m.action.type === ActionType.Loading
|
|
@@ -450,8 +475,23 @@ function PalletFaces({ maxNumFaces, mats: allMats, loadingOntoPallet, noFilter,
|
|
|
450
475
|
}, children: _jsx(MaterialIcon, { mats: mats }) }, face))) }));
|
|
451
476
|
}
|
|
452
477
|
}
|
|
453
|
-
function BasketContents({ mats }) {
|
|
454
|
-
|
|
478
|
+
function BasketContents({ basketId, mats, maxNumFaces, }) {
|
|
479
|
+
// the basket's material list also contains material loading into it from elsewhere
|
|
480
|
+
const bySlot = LazySeq.of(mats)
|
|
481
|
+
.filter((m) => m.location.type === LocType.InBasket && m.location.basketId === basketId)
|
|
482
|
+
.orderedGroupBy((m) => m.location.basketSlot ?? 1);
|
|
483
|
+
if (maxNumFaces !== undefined) {
|
|
484
|
+
// at a load station, slots line up in columns like pallet faces
|
|
485
|
+
return (_jsx(Box, { sx: {
|
|
486
|
+
display: "grid",
|
|
487
|
+
gridTemplateRows: `${CollapsedIconSize}px`,
|
|
488
|
+
gridTemplateColumns: `repeat(${maxNumFaces}, ${CollapsedIconSize}px)`,
|
|
489
|
+
columnGap: "5px",
|
|
490
|
+
height: "100%",
|
|
491
|
+
alignContent: "center",
|
|
492
|
+
justifyContent: "center",
|
|
493
|
+
}, children: bySlot.map(([slot, slotMats]) => (_jsx(Box, { sx: { gridColumn: Math.min(slot, maxNumFaces), gridRow: 1 }, children: _jsx(MaterialIcon, { mats: slotMats }) }, slot))) }));
|
|
494
|
+
}
|
|
455
495
|
return (_jsx(Box, { sx: {
|
|
456
496
|
display: "flex",
|
|
457
497
|
flexWrap: "wrap",
|
|
@@ -463,7 +503,7 @@ function BasketContents({ mats }) {
|
|
|
463
503
|
paddingRight: "5px",
|
|
464
504
|
height: "100%",
|
|
465
505
|
alignContent: "center",
|
|
466
|
-
}, children:
|
|
506
|
+
}, children: bySlot.map(([slot, slotMats]) => (_jsx(Box, { children: _jsx(MaterialIcon, { mats: slotMats }) }, slot))) }));
|
|
467
507
|
}
|
|
468
508
|
function SourceRowContents({ mats, maxNumFaces, }) {
|
|
469
509
|
return (_jsx(Box, { sx: {
|
|
@@ -680,7 +720,7 @@ function LoadStation({ maxNumFaces, maxNumStagingRows, maxNumSourceRows, load, }
|
|
|
680
720
|
flexDirection: "column",
|
|
681
721
|
justifyContent: "center",
|
|
682
722
|
borderBottom: "1px solid black",
|
|
683
|
-
}, children: [load.pal ? _jsx(PalletFaces, { mats: load.pal.mats, maxNumFaces: maxNumFaces }) : undefined, !load.pal && load.basket ? _jsx(BasketContents, { mats: load.basket.mats }) : undefined] }), Array.from({ length: numStagingRows }, (_, i) => {
|
|
723
|
+
}, children: [load.pal ? _jsx(PalletFaces, { mats: load.pal.mats, maxNumFaces: maxNumFaces }) : undefined, !load.pal && load.basket ? (_jsx(BasketContents, { basketId: load.basket.basket.basketId, mats: load.basket.mats, maxNumFaces: maxNumFaces })) : undefined] }), Array.from({ length: numStagingRows }, (_, i) => {
|
|
684
724
|
const row = load.staging[i] ?? null;
|
|
685
725
|
const isLastRow = i === numStagingRows - 1;
|
|
686
726
|
return (_jsxs(Fragment, { children: [_jsx(Box, { sx: {
|
|
@@ -697,7 +737,7 @@ function LoadStation({ maxNumFaces, maxNumStagingRows, maxNumSourceRows, load, }
|
|
|
697
737
|
display: "flex",
|
|
698
738
|
flexDirection: "column",
|
|
699
739
|
justifyContent: "center",
|
|
700
|
-
}, children: row ? _jsx(BasketContents, { mats: row.mats }) : undefined })] }, `stage-${i}`));
|
|
740
|
+
}, children: row ? (_jsx(BasketContents, { basketId: row.basket.basketId, mats: row.mats, maxNumFaces: maxNumFaces })) : undefined })] }, `stage-${i}`));
|
|
701
741
|
})] }));
|
|
702
742
|
}
|
|
703
743
|
function MachineAtLoadLabel({ status }) {
|
|
@@ -789,7 +829,7 @@ function FloatingBasket({ basket }) {
|
|
|
789
829
|
gridArea: "basketname",
|
|
790
830
|
padding: "0.2em",
|
|
791
831
|
borderBottom: "1px solid black",
|
|
792
|
-
}, children: [basketName, " ", basket.basket.basketId] }), _jsx(Box, { sx: { gridArea: "basketmat" }, children: _jsx(BasketContents, { mats: basket.mats }) })] }));
|
|
832
|
+
}, children: [basketName, " ", basket.basket.basketId] }), _jsx(Box, { sx: { gridArea: "basketmat" }, children: _jsx(BasketContents, { basketId: basket.basket.basketId, mats: basket.mats }) })] }));
|
|
793
833
|
}
|
|
794
834
|
function BasketStorageSummary({ empty, filled }) {
|
|
795
835
|
const basketName = basketDisplayName(useAtomValue(fmsInformation).basketName);
|
|
@@ -34,9 +34,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
34
34
|
import { memo, useMemo, useState } from "react";
|
|
35
35
|
import { closestCenter, DndContext, DragOverlay, KeyboardSensor, PointerSensor, useSensor, useSensors, } from "@dnd-kit/core";
|
|
36
36
|
import { rectSortingStrategy, SortableContext, sortableKeyboardCoordinates, verticalListSortingStrategy, } from "@dnd-kit/sortable";
|
|
37
|
-
import {
|
|
38
|
-
import { reorderQueuedMatInCurrentStatus } from "../../cell-status/current-status.js";
|
|
37
|
+
import { moveQueuedMatInCurrentStatus } from "../../cell-status/loading.js";
|
|
39
38
|
import { currentOperator } from "../../data/operators.js";
|
|
39
|
+
import { canSetMaterialInQueue } from "../../data/material-operation-policy.js";
|
|
40
40
|
import { useAtomValue, useSetAtom } from "jotai";
|
|
41
41
|
function isSortableMatData(value) {
|
|
42
42
|
return typeof value === "object" && value !== null && "mat" in value;
|
|
@@ -46,8 +46,7 @@ function numericId(id) {
|
|
|
46
46
|
}
|
|
47
47
|
export const SortableRegion = memo(function SortableRegion(props) {
|
|
48
48
|
const [activeMat, setActiveMat] = useState(undefined);
|
|
49
|
-
const
|
|
50
|
-
const reorderQueuedMat = useSetAtom(reorderQueuedMatInCurrentStatus);
|
|
49
|
+
const moveQueuedMat = useSetAtom(moveQueuedMatInCurrentStatus);
|
|
51
50
|
const operator = useAtomValue(currentOperator);
|
|
52
51
|
const sortableItemIds = useMemo(() => props.matIds.slice(), [props.matIds]);
|
|
53
52
|
const sensors = useSensors(useSensor(PointerSensor), useSensor(KeyboardSensor, {
|
|
@@ -56,19 +55,19 @@ export const SortableRegion = memo(function SortableRegion(props) {
|
|
|
56
55
|
return (_jsx(DndContext, { sensors: sensors, collisionDetection: closestCenter, onDragStart: ({ active }) => setActiveMat(isSortableMatData(active.data.current) ? active.data.current.mat : undefined), onDragCancel: () => setActiveMat(undefined), onDragEnd: ({ active, over }) => {
|
|
57
56
|
const activeMatId = numericId(active.id);
|
|
58
57
|
const overMatId = over ? numericId(over.id) : null;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
reorderQueuedMat({
|
|
58
|
+
const mat = isSortableMatData(active.data.current) ? active.data.current.mat : null;
|
|
59
|
+
if (over &&
|
|
60
|
+
active.id !== over.id &&
|
|
61
|
+
activeMatId !== null &&
|
|
62
|
+
overMatId !== null &&
|
|
63
|
+
mat !== null &&
|
|
64
|
+
canSetMaterialInQueue(mat, props.queueName)) {
|
|
65
|
+
moveQueuedMat({
|
|
68
66
|
queue: props.queueName,
|
|
69
67
|
matId: activeMatId,
|
|
70
|
-
newIdx:
|
|
71
|
-
|
|
68
|
+
newIdx: props.matIds.indexOf(overMatId),
|
|
69
|
+
operator,
|
|
70
|
+
}).catch(console.error);
|
|
72
71
|
}
|
|
73
72
|
setActiveMat(undefined);
|
|
74
73
|
}, children: _jsxs(SortableContext, { items: sortableItemIds, strategy: props.direction === "vertical" ? verticalListSortingStrategy : rectSortingStrategy, children: [props.children, _jsx(DragOverlay, { children: activeMat !== undefined ? props.renderDragOverlay(activeMat) : undefined })] }) }));
|
|
@@ -18,4 +18,10 @@ export declare function canDirectlyQuarantine(material: MaterialForPolicy): bool
|
|
|
18
18
|
export declare function canRemoveFromQueue(material: MaterialForPolicy): boolean;
|
|
19
19
|
export declare function canInvalidateMaterial(material: MaterialForPolicy): boolean;
|
|
20
20
|
export declare function canAddOrMoveMaterialToQueue(material: MaterialForPolicy): boolean;
|
|
21
|
+
export declare function canReorderQueuedMaterial(material: MaterialForPolicy): boolean;
|
|
22
|
+
export declare function canSetMaterialInQueue(material: MaterialForPolicy, queue: string): boolean;
|
|
23
|
+
export declare function quarantineRoute(material: Readonly<IInProcessMaterial>): {
|
|
24
|
+
readonly process: number;
|
|
25
|
+
readonly path: number;
|
|
26
|
+
};
|
|
21
27
|
export {};
|
|
@@ -46,8 +46,10 @@ function hasLoadStationAction(material) {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
export function materialOperationState(material) {
|
|
49
|
+
if (material.action.automatedTransfer === true)
|
|
50
|
+
return { kind: "AutomationControlled" };
|
|
49
51
|
const cancellationId = nonBlankCancellationId(material);
|
|
50
|
-
if (
|
|
52
|
+
if (material.action.loadCancellationId !== undefined || hasLoadStationAction(material)) {
|
|
51
53
|
return { kind: "ActiveLoadStationOperation", cancellationId };
|
|
52
54
|
}
|
|
53
55
|
if (material.location.type === LocType.InQueue && material.action.type === ActionType.Waiting) {
|
|
@@ -70,7 +72,11 @@ export function canCancelLoad(material) {
|
|
|
70
72
|
return state.kind === "ActiveLoadStationOperation" && state.cancellationId !== null;
|
|
71
73
|
}
|
|
72
74
|
export function canSignalQuarantine(material) {
|
|
73
|
-
return material !== null &&
|
|
75
|
+
return (material !== null &&
|
|
76
|
+
material.materialID >= 0 &&
|
|
77
|
+
(materialOperationState(material).kind === "AutomationControlled" ||
|
|
78
|
+
material.action.type === ActionType.UnloadToInProcess ||
|
|
79
|
+
material.action.type === ActionType.UnloadToCompletedMaterial));
|
|
74
80
|
}
|
|
75
81
|
export function canDirectlyQuarantine(material) {
|
|
76
82
|
return material !== null && materialOperationState(material).kind === "HumanControlledQueue";
|
|
@@ -87,3 +93,21 @@ export function canAddOrMoveMaterialToQueue(material) {
|
|
|
87
93
|
const state = materialOperationState(material);
|
|
88
94
|
return state.kind === "AddToQueueProposal" || state.kind === "HumanControlledQueue";
|
|
89
95
|
}
|
|
96
|
+
export function canReorderQueuedMaterial(material) {
|
|
97
|
+
// Priority changes within the source queue remain allowed during human station work.
|
|
98
|
+
return (material !== null &&
|
|
99
|
+
material.location.type === LocType.InQueue &&
|
|
100
|
+
material.action.automatedTransfer !== true);
|
|
101
|
+
}
|
|
102
|
+
export function canSetMaterialInQueue(material, queue) {
|
|
103
|
+
return material?.location.type === LocType.InQueue && material.location.currentQueue === queue
|
|
104
|
+
? canReorderQueuedMaterial(material)
|
|
105
|
+
: canAddOrMoveMaterialToQueue(material);
|
|
106
|
+
}
|
|
107
|
+
export function quarantineRoute(material) {
|
|
108
|
+
return material.action.automatedTransfer === true &&
|
|
109
|
+
(material.action.type === ActionType.Loading ||
|
|
110
|
+
material.action.type === ActionType.LoadingToBasket)
|
|
111
|
+
? { process: material.action.processAfterLoad ?? 0, path: material.action.pathAfterLoad ?? 0 }
|
|
112
|
+
: { process: material.process, path: material.path };
|
|
113
|
+
}
|
|
@@ -22,6 +22,7 @@ export type MoveMaterialNodeKind = {
|
|
|
22
22
|
readonly type: MoveMaterialNodeKindType.CompletedExpandedMaterialZone;
|
|
23
23
|
} | {
|
|
24
24
|
readonly type: MoveMaterialNodeKindType.PalletFaceZone;
|
|
25
|
+
readonly palletNum: number;
|
|
25
26
|
readonly face: number;
|
|
26
27
|
} | {
|
|
27
28
|
readonly type: MoveMaterialNodeKindType.QueueZone;
|
|
@@ -41,11 +42,17 @@ export type AllMoveMaterialNodes<T> = HashMap<MoveMaterialIdentifier, MoveMateri
|
|
|
41
42
|
readonly elem: T;
|
|
42
43
|
}>;
|
|
43
44
|
export type MoveMaterialArrow = {
|
|
45
|
+
readonly type: "curve";
|
|
44
46
|
readonly fromX: number;
|
|
45
47
|
readonly fromY: number;
|
|
46
48
|
readonly toX: number;
|
|
47
49
|
readonly toY: number;
|
|
48
50
|
readonly curveDirection: number;
|
|
51
|
+
} | {
|
|
52
|
+
readonly type: "loop";
|
|
53
|
+
readonly centerX: number;
|
|
54
|
+
readonly centerY: number;
|
|
55
|
+
readonly radius: number;
|
|
49
56
|
};
|
|
50
57
|
export type MoveMaterialElemRect = {
|
|
51
58
|
readonly left: number;
|