@seedtactics/insight-client 17.0.1-beta.9 → 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
|
@@ -33,6 +33,8 @@ import { Alert, Box, Button, Stack, Typography } from "@mui/material";
|
|
|
33
33
|
import { LazySeq } from "@seedtactics/immutable-collections";
|
|
34
34
|
import { basketSlotLabel } from "../../cell-status/station-cycles.js";
|
|
35
35
|
import * as api from "../../network/api.js";
|
|
36
|
+
import { serverErrorMessage } from "../../network/api-errors.js";
|
|
37
|
+
import { JobsBackend } from "../../network/backend.js";
|
|
36
38
|
import { InProcMaterial } from "./Material.js";
|
|
37
39
|
import { MoveMaterialArrowNode } from "./MoveMaterialArrows.js";
|
|
38
40
|
import { MoveMaterialNodeKindType } from "../../data/move-arrows.js";
|
|
@@ -112,36 +114,16 @@ function stationWork(material, basket) {
|
|
|
112
114
|
},
|
|
113
115
|
};
|
|
114
116
|
}
|
|
115
|
-
|
|
116
|
-
return { type: "none" };
|
|
117
|
-
const tagged = validActions.filter((action) => isNonBlank(action.workId));
|
|
118
|
-
const workIds = LazySeq.of(tagged).toHashSet(({ workId }) => workId);
|
|
119
|
-
if (tagged.length !== validActions.length || workIds.size !== 1) {
|
|
120
|
-
return { type: "inconsistent" };
|
|
121
|
-
}
|
|
122
|
-
return {
|
|
123
|
-
type: "active",
|
|
124
|
-
work: { workId: tagged[0].workId, ready: true, confirmEmpty: false, awaitingSlots: [] },
|
|
125
|
-
};
|
|
117
|
+
return { type: validActions.length === 0 ? "none" : "inconsistent" };
|
|
126
118
|
}
|
|
127
|
-
function
|
|
128
|
-
|
|
129
|
-
mat.location.basketId === mat.action.loadToBasketId &&
|
|
130
|
-
mat.location.basketSlot === mat.action.loadToBasketSlot) {
|
|
131
|
-
return "Unload, re-plate, and reload this slot";
|
|
132
|
-
}
|
|
133
|
-
if (mat.location.type === api.LocType.InQueue && mat.location.currentQueue) {
|
|
134
|
-
return `Load from ${mat.location.currentQueue}`;
|
|
135
|
-
}
|
|
136
|
-
return "Load from raw material";
|
|
137
|
-
}
|
|
138
|
-
function SlotMaterial({ material, fsize, }) {
|
|
139
|
-
return material.map((mat) => (_jsx(MoveMaterialArrowNode, { kind: { type: MoveMaterialNodeKindType.Material, material: mat }, children: _jsx(InProcMaterial, { mat: mat, fsize: fsize }) }, mat.materialID)));
|
|
119
|
+
function SlotMaterial({ material, basketId, fsize, }) {
|
|
120
|
+
return material.map((mat) => (_jsx(MoveMaterialArrowNode, { kind: { type: MoveMaterialNodeKindType.Material, material: mat }, children: _jsx(InProcMaterial, { mat: mat, displayActionForSingleBasket: basketId, fsize: fsize }) }, mat.materialID)));
|
|
140
121
|
}
|
|
141
|
-
export function BasketLoadStationWorkflow({
|
|
122
|
+
export function BasketLoadStationWorkflow({ basket, material, fsize, title, elapsed, }) {
|
|
142
123
|
const [submission, setSubmission] = useState();
|
|
143
124
|
const workState = useMemo(() => stationWork(material, basket), [basket, material]);
|
|
144
125
|
const blockedReason = basket.loadStationWork?.confirmationBlockedReason?.trim();
|
|
126
|
+
const instructionWarning = basket.loadStationWork?.instructionWarning?.trim();
|
|
145
127
|
const work = workState.type === "active" ? workState.work : undefined;
|
|
146
128
|
const submissionState = submission !== undefined &&
|
|
147
129
|
submission.workId === work?.workId &&
|
|
@@ -151,6 +133,7 @@ export function BasketLoadStationWorkflow({ stationNumber, basket, material, fsi
|
|
|
151
133
|
(submission.basket === basket && submission.material === material))
|
|
152
134
|
? submission.state
|
|
153
135
|
: "idle";
|
|
136
|
+
const submissionReason = submissionState === "idle" ? null : (submission?.reason ?? null);
|
|
154
137
|
const materialBySlot = useMemo(() => LazySeq.of(material)
|
|
155
138
|
.filter((mat) => mat.location.type === api.LocType.InBasket &&
|
|
156
139
|
mat.location.basketId === basket.basketId &&
|
|
@@ -170,38 +153,90 @@ export function BasketLoadStationWorkflow({ stationNumber, basket, material, fsi
|
|
|
170
153
|
.distinctBy((slot) => slot)
|
|
171
154
|
.toSortedArray((slot) => slot), [basket.emptySlots, basket.unknownSlots, materialBySlot, loadsBySlot]);
|
|
172
155
|
async function submit() {
|
|
173
|
-
if (work === undefined || !work.ready
|
|
156
|
+
if (work === undefined || !work.ready)
|
|
174
157
|
return;
|
|
175
158
|
const submittedWorkId = work.workId;
|
|
176
|
-
const pending = {
|
|
159
|
+
const pending = {
|
|
160
|
+
workId: submittedWorkId,
|
|
161
|
+
basket,
|
|
162
|
+
material,
|
|
163
|
+
state: "submitting",
|
|
164
|
+
reason: null,
|
|
165
|
+
};
|
|
177
166
|
setSubmission(pending);
|
|
178
167
|
try {
|
|
179
|
-
|
|
168
|
+
await JobsBackend.completeBasketLoadStation(new api.BasketLoadStationCompletion({ workId: submittedWorkId }));
|
|
169
|
+
const state = "accepted";
|
|
180
170
|
setSubmission((current) => (current === pending ? { ...pending, state } : current));
|
|
181
171
|
}
|
|
182
|
-
catch {
|
|
183
|
-
|
|
172
|
+
catch (error) {
|
|
173
|
+
const state = api.ApiException.isApiException(error) && error.status === 409 ? "conflict" : "error";
|
|
174
|
+
const reason = serverErrorMessage(error);
|
|
175
|
+
setSubmission((current) => (current === pending ? { ...pending, state, reason } : current));
|
|
184
176
|
}
|
|
185
177
|
}
|
|
186
178
|
const submissionDisabled = !work?.ready ||
|
|
187
179
|
submissionState === "submitting" ||
|
|
188
180
|
submissionState === "accepted" ||
|
|
189
181
|
submissionState === "conflict";
|
|
190
|
-
|
|
182
|
+
// Confirm sits in the header so it is visible without scrolling. Slots are drawn like pallet
|
|
183
|
+
// faces: stacked regions holding their material side by side. All material in a slot moves
|
|
184
|
+
// together.
|
|
185
|
+
return (_jsxs("div", { children: [_jsxs(Box, { sx: {
|
|
191
186
|
display: "grid",
|
|
192
|
-
gridTemplateColumns: "
|
|
193
|
-
|
|
194
|
-
|
|
187
|
+
gridTemplateColumns: "1fr auto auto",
|
|
188
|
+
alignItems: "center",
|
|
189
|
+
columnGap: 4,
|
|
190
|
+
}, children: [title, _jsx(Box, { children: work ? (_jsx(Button, { variant: "contained", color: "secondary", size: "large", disabled: submissionDisabled, onClick: () => void submit(), children: "Confirm" })) : null }), _jsx(Box, { sx: {
|
|
191
|
+
justifySelf: "flex-end",
|
|
192
|
+
minWidth: "8ch",
|
|
193
|
+
textAlign: "right",
|
|
194
|
+
fontVariantNumeric: "tabular-nums",
|
|
195
|
+
}, children: elapsed })] }), _jsxs(Stack, { spacing: 2, sx: { ml: "4em", mr: "4em", mt: 2 }, children: [work?.confirmEmpty && work.ready && (_jsxs(Typography, { children: ["Confirm basket ", basket.basketId, " is empty."] })), instructionWarning && _jsx(Alert, { severity: "warning", children: instructionWarning }), work && !work.ready && (_jsx(Alert, { severity: "info", children: blockedReason ||
|
|
196
|
+
(work.awaitingSlots.length > 0
|
|
197
|
+
? `Waiting for material for slots ${work.awaitingSlots.map(basketSlotLabel).join(", ")}.`
|
|
198
|
+
: "Basket work is not ready for confirmation.") })), !work && workState.type === "inconsistent" ? (_jsx(Alert, { severity: "warning", children: "Basket work is inconsistent. Wait for refreshed material actions before confirming." })) : null, submissionState === "accepted" ? (_jsx(Alert, { severity: "success", children: "Confirmation accepted. Waiting for refreshed work." })) : submissionState === "conflict" ? (_jsx(Alert, { severity: "warning", children: submissionReason ??
|
|
199
|
+
"Basket work changed before confirmation. Review the refreshed slots and try again." })) : submissionState === "error" ? (_jsxs(Alert, { severity: "error", children: ["Unable to confirm basket work", submissionReason ? `: ${submissionReason}` : ".", " No work was assumed complete."] })) : null] }), _jsx(MoveMaterialArrowNode, { kind: { type: MoveMaterialNodeKindType.BasketZone, basketId: basket.basketId }, children: slots.map((slot, idx) => {
|
|
195
200
|
const slotMaterial = materialBySlot.get(slot) ?? [];
|
|
196
|
-
const loads = loadsBySlot.get(slot) ?? [];
|
|
197
201
|
const isUnknown = basket.unknownSlots?.includes(slot) === true;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
202
|
+
const targetContents = LazySeq.of(slotMaterial)
|
|
203
|
+
.filter((mat) => mat.action.type !== api.ActionType.UnloadToInProcess &&
|
|
204
|
+
mat.action.type !== api.ActionType.UnloadToCompletedMaterial)
|
|
205
|
+
.concat(loadsBySlot.get(slot) ?? [])
|
|
206
|
+
.map((mat) => {
|
|
207
|
+
const process = mat.action.type === api.ActionType.LoadingToBasket
|
|
208
|
+
? mat.action.processAfterLoad
|
|
209
|
+
: mat.process;
|
|
210
|
+
return `${mat.partName}${process !== undefined ? ` proc ${process}` : ""}`;
|
|
211
|
+
})
|
|
212
|
+
.distinctBy((label) => label)
|
|
213
|
+
.toRArray();
|
|
214
|
+
const targetEmpty = work?.confirmEmpty ||
|
|
215
|
+
(!isUnknown && (slotMaterial.length > 0 || basket.emptySlots?.includes(slot) === true));
|
|
216
|
+
const target = work && !work.awaitingSlots.includes(slot)
|
|
217
|
+
? targetContents.length > 0
|
|
218
|
+
? `Fill with ${targetContents.join(", ")}`
|
|
219
|
+
: targetEmpty
|
|
220
|
+
? "Leave empty"
|
|
221
|
+
: undefined
|
|
222
|
+
: undefined;
|
|
223
|
+
return (_jsxs(Box, { component: "section", "data-testid": `basket-load-station-slot-${slot}`, sx: { borderTop: idx !== 0 ? "1px solid black" : undefined, py: 3 }, children: [_jsxs(Box, { sx: {
|
|
224
|
+
display: "flex",
|
|
225
|
+
justifyContent: "center",
|
|
226
|
+
alignItems: "center",
|
|
227
|
+
flexWrap: "wrap",
|
|
228
|
+
columnGap: 1,
|
|
229
|
+
color: "text.secondary",
|
|
230
|
+
mb: 2,
|
|
231
|
+
}, children: [_jsxs(Typography, { variant: "h6", sx: { color: "text.primary" }, children: ["Slot ", basketSlotLabel(slot)] }), target && (_jsxs(Box, { component: "span", sx: { display: "inline-flex", alignItems: "center", gap: 1 }, children: [_jsx(Typography, { component: "span", variant: "body2", color: "inherit", "aria-hidden": true, children: "\u00B7" }), _jsx(Typography, { component: "span", variant: "body2", color: "inherit", children: target })] }))] }), _jsx(Box, { sx: { ml: "4em", mr: "4em" }, children: _jsx(MoveMaterialArrowNode, { kind: {
|
|
232
|
+
type: MoveMaterialNodeKindType.BasketSlotZone,
|
|
233
|
+
basketId: basket.basketId,
|
|
234
|
+
slot,
|
|
235
|
+
}, children: _jsx(Box, { sx: {
|
|
236
|
+
display: "flex",
|
|
237
|
+
flexWrap: "wrap",
|
|
238
|
+
justifyContent: "space-around",
|
|
239
|
+
minHeight: "4em",
|
|
240
|
+
}, children: slotMaterial.length > 0 ? (_jsx(SlotMaterial, { material: slotMaterial, basketId: basket.basketId, fsize: fsize })) : isUnknown ? (_jsx(Typography, { color: "warning.main", children: "Unknown" })) : null }) }) })] }, slot));
|
|
241
|
+
}) })] }));
|
|
207
242
|
}
|
|
@@ -7,7 +7,8 @@ import { currentStatus } from "../../cell-status/current-status.js";
|
|
|
7
7
|
import { inProcessMaterialInDialog, materialDialogOpen, } from "../../cell-status/material-details.js";
|
|
8
8
|
import { currentOperator } from "../../data/operators.js";
|
|
9
9
|
import { JobsBackend } from "../../network/backend.js";
|
|
10
|
-
import {
|
|
10
|
+
import { CancelLoadRequest } from "../../network/api.js";
|
|
11
|
+
import { apiErrorMessage } from "../../network/api-errors.js";
|
|
11
12
|
import { canCancelLoad } from "../../data/material-operation-policy.js";
|
|
12
13
|
export function CancelLoadButton({ onClose, ignoreOperator = false, }) {
|
|
13
14
|
const material = useAtomValue(inProcessMaterialInDialog);
|
|
@@ -41,11 +42,13 @@ export function CancelLoadButton({ onClose, ignoreOperator = false, }) {
|
|
|
41
42
|
expectedLoadCancellationId: snapshot.cancellationId,
|
|
42
43
|
reason: reason || undefined,
|
|
43
44
|
}));
|
|
45
|
+
setOpen(false);
|
|
46
|
+
setSnapshot(null);
|
|
44
47
|
setMaterialDialogOpen(null);
|
|
45
48
|
onClose?.();
|
|
46
49
|
}
|
|
47
50
|
catch (e) {
|
|
48
|
-
setError(
|
|
51
|
+
setError(apiErrorMessage(e));
|
|
49
52
|
}
|
|
50
53
|
finally {
|
|
51
54
|
setUpdating(false);
|
|
@@ -56,5 +59,7 @@ export function CancelLoadButton({ onClose, ignoreOperator = false, }) {
|
|
|
56
59
|
setReason("");
|
|
57
60
|
setError(null);
|
|
58
61
|
setOpen(true);
|
|
59
|
-
}, children: "Cancel Load" }) })) : null, _jsxs(Dialog, { open: open && snapshot !== null, onClose: () => setOpen(false), children: [_jsx(DialogTitle, { children: "Cancel Load" }), _jsxs(DialogContent, { children: [_jsx("p", { children: "The displayed load instruction will be cancelled and recalculated for:" }), _jsx("ul", { children: snapshot?.group.map((candidate) => (_jsx("li", { children: candidate.
|
|
62
|
+
}, children: "Cancel Load" }) })) : null, _jsxs(Dialog, { open: open && snapshot !== null, onClose: () => setOpen(false), children: [_jsx(DialogTitle, { children: "Cancel Load" }), _jsxs(DialogContent, { children: [_jsx("p", { children: "The displayed load instruction will be cancelled and recalculated for:" }), _jsx("ul", { children: snapshot?.group.map((candidate, index) => (_jsx("li", { children: candidate.materialID < 0
|
|
63
|
+
? `${candidate.partName} raw material`
|
|
64
|
+
: candidate.serial || `Material ID ${candidate.materialID}` }, candidate.materialID >= 0 ? candidate.materialID : `raw-${index}`))) }), _jsx(TextField, { label: "Reason (optional)", value: reason, onChange: (e) => setReason(e.target.value), fullWidth: true, multiline: true }), error ? _jsx("p", { role: "alert", children: error }) : null] }), _jsxs(DialogActions, { children: [_jsx(Button, { color: "primary", disabled: updating, onClick: cancelLoad, children: "Cancel Load" }), _jsx(Button, { color: "secondary", disabled: updating, onClick: () => setOpen(false), children: "Keep Load" })] })] })] }));
|
|
60
65
|
}
|
|
@@ -41,12 +41,12 @@ import { currentStatus } from "../../cell-status/current-status.js";
|
|
|
41
41
|
import { barcodePotentialNewMaterial, inProcessMaterialInDialog, materialDialogOpen, materialInDialogInfo, materialInDialogLargestUsedProcess, materialInDialogLocalEvents, } from "../../cell-status/material-details.js";
|
|
42
42
|
import { currentOperator } from "../../data/operators.js";
|
|
43
43
|
import { fmsInformation } from "../../network/server-settings.js";
|
|
44
|
-
import { useAtomValue, useSetAtom } from "jotai";
|
|
44
|
+
import { useAtomValue, useAtomValueRawSync, useSetAtom } from "jotai";
|
|
45
45
|
import { useEffect, useRef } from "react";
|
|
46
46
|
import { last30Jobs } from "../../cell-status/scheduled-jobs.js";
|
|
47
47
|
import { PartIdenticon } from "./Material.js";
|
|
48
48
|
import { isLogEntryInvalidated } from "../LogEntry.js";
|
|
49
|
-
import {
|
|
49
|
+
import { apiErrorMessage } from "../../network/api-errors.js";
|
|
50
50
|
import { canInvalidateMaterial } from "../../data/material-operation-policy.js";
|
|
51
51
|
const invalidatableEventTypes = LazySeq.of([
|
|
52
52
|
LogType.AddToQueue,
|
|
@@ -82,12 +82,15 @@ function InvalidateSelect(props) {
|
|
|
82
82
|
job: currentSt.jobs[j.jobUnique] ?? history.get(j.jobUnique) ?? null,
|
|
83
83
|
}));
|
|
84
84
|
const hasProc = lastMat !== null && lastMat.process >= 1;
|
|
85
|
-
const
|
|
85
|
+
const canChangeAssignment = lastMat === null || lastMat.process <= 1;
|
|
86
|
+
const hasChangeMat = canChangeAssignment && (castings.length > 0 || jobs.length > 0);
|
|
86
87
|
const selectedCasting = props.st?.changeRawMat !== null &&
|
|
87
88
|
props.st?.changeRawMat !== undefined &&
|
|
89
|
+
canChangeAssignment &&
|
|
88
90
|
castings.includes(props.st.changeRawMat);
|
|
89
91
|
const selectedJob = props.st?.changeJobUnique !== null &&
|
|
90
92
|
props.st?.changeJobUnique !== undefined &&
|
|
93
|
+
canChangeAssignment &&
|
|
91
94
|
jobs.some((job) => job.jobUnique === props.st?.changeJobUnique);
|
|
92
95
|
function change(e) {
|
|
93
96
|
props.setState({
|
|
@@ -102,7 +105,7 @@ function InvalidateSelect(props) {
|
|
|
102
105
|
? "rawMat" + props.st.changeRawMat
|
|
103
106
|
: selectedJob
|
|
104
107
|
? "job" + props.st.changeJobUnique
|
|
105
|
-
: props.st?.process && hasProc
|
|
108
|
+
: props.st?.process && hasProc && props.st.process === lastMat.process
|
|
106
109
|
? "proc" + props.st.process.toString()
|
|
107
110
|
: "", select: true, onChange: (e) => change(e.target.value), variant: "outlined", label: props.st?.changeRawMat
|
|
108
111
|
? "Change Raw Material"
|
|
@@ -119,11 +122,6 @@ function InvalidateSelect(props) {
|
|
|
119
122
|
hasProc
|
|
120
123
|
? [
|
|
121
124
|
_jsxs(MenuItem, { value: "proc" + lastMat.process.toString(), children: ["Invalidate Process ", lastMat.process] }, lastMat.process),
|
|
122
|
-
...(lastMat.process > 1
|
|
123
|
-
? [
|
|
124
|
-
_jsx(MenuItem, { value: "proc1", children: "Invalidate All Processes" }, "all"),
|
|
125
|
-
]
|
|
126
|
-
: []),
|
|
127
125
|
]
|
|
128
126
|
: [],
|
|
129
127
|
hasProc && hasChangeMat
|
|
@@ -131,15 +129,17 @@ function InvalidateSelect(props) {
|
|
|
131
129
|
: [],
|
|
132
130
|
hasChangeMat
|
|
133
131
|
? [
|
|
134
|
-
...castings.map((c) => (_jsxs(MenuItem, { value: "rawMat" + c, children: ["Invalidate
|
|
135
|
-
...jobs.map(({ jobUnique, job }) => (_jsxs(MenuItem, { value: "job" + jobUnique, children: [job ? (_jsx(ListItemIcon, { children: _jsx(PartIdenticon, { part: job.partName }) })) : undefined, _jsx(ListItemText, { primary: "Invalidate
|
|
132
|
+
...castings.map((c) => (_jsxs(MenuItem, { value: "rawMat" + c, children: [hasProc ? "Invalidate Process 1 and Change to " : "Change to ", c] }, "rawMat" + c))),
|
|
133
|
+
...jobs.map(({ jobUnique, job }) => (_jsxs(MenuItem, { value: "job" + jobUnique, children: [job ? (_jsx(ListItemIcon, { children: _jsx(PartIdenticon, { part: job.partName }) })) : undefined, _jsx(ListItemText, { primary: (hasProc ? "Invalidate Process 1 and Change to Job " : "Change to Job ") +
|
|
134
|
+
jobUnique, secondary: job?.partName })] }, "job" + jobUnique))),
|
|
136
135
|
]
|
|
137
136
|
: [],
|
|
138
137
|
] }));
|
|
139
138
|
}
|
|
140
139
|
export function InvalidateCycleDialogContent(props) {
|
|
141
140
|
const curMat = useAtomValue(materialInDialogInfo);
|
|
142
|
-
|
|
141
|
+
// History can resolve while InvalidateSelect suspends, before this component subscribes.
|
|
142
|
+
const events = useAtomValueRawSync(materialInDialogLocalEvents);
|
|
143
143
|
const status = useAtomValue(currentStatus);
|
|
144
144
|
const show = props.st !== null && curMat !== null;
|
|
145
145
|
const boxRef = useRef(null);
|
|
@@ -182,13 +182,15 @@ export function InvalidateCycleDialogButton(props) {
|
|
|
182
182
|
return null;
|
|
183
183
|
if (!canInvalidateMaterial(inProcMat))
|
|
184
184
|
return null;
|
|
185
|
-
const allowChange =
|
|
185
|
+
const allowChange = (lastMat === null || lastMat.process <= 1) &&
|
|
186
|
+
possibleNew !== null &&
|
|
186
187
|
(!LazySeq.ofObject(possibleNew.possibleCastingsByQueue ?? {}).isEmpty() ||
|
|
187
188
|
!LazySeq.ofObject(possibleNew.possibleJobsByQueue ?? {}).isEmpty());
|
|
188
189
|
if (!allowChange && (lastMat === null || lastMat.process < 1))
|
|
189
190
|
return null;
|
|
190
191
|
if (props.ignoreOperator)
|
|
191
192
|
operator = null;
|
|
193
|
+
const changingAssignment = props.st !== null && (props.st.changeRawMat !== null || props.st.changeJobUnique !== null);
|
|
192
194
|
function showInvalidate() {
|
|
193
195
|
props.setState({
|
|
194
196
|
process: null,
|
|
@@ -219,27 +221,26 @@ export function InvalidateCycleDialogButton(props) {
|
|
|
219
221
|
props.setState({
|
|
220
222
|
...props.st,
|
|
221
223
|
updating: false,
|
|
222
|
-
error:
|
|
223
|
-
? e.response
|
|
224
|
-
: e instanceof Error
|
|
225
|
-
? e.message
|
|
226
|
-
: String(e),
|
|
224
|
+
error: apiErrorMessage(e),
|
|
227
225
|
});
|
|
228
226
|
});
|
|
229
227
|
}
|
|
230
228
|
}
|
|
231
229
|
return (_jsxs(_Fragment, { children: [props.st === null ? (_jsx(Button, { color: "primary", onClick: showInvalidate, children: "Invalidate Cycle" })) : undefined, props.st !== null ? (_jsx(Button, { color: "primary", onClick: invalidateCycle, disabled: props.st.updating ||
|
|
230
|
+
(changingAssignment && !allowChange) ||
|
|
231
|
+
(!changingAssignment &&
|
|
232
|
+
props.st.process !== null &&
|
|
233
|
+
props.st.process !== lastMat?.process) ||
|
|
232
234
|
(props.st.process === null &&
|
|
233
235
|
props.st.changeRawMat === null &&
|
|
234
236
|
props.st.changeJobUnique === null), children: props.st.changeJobUnique !== null
|
|
235
|
-
?
|
|
237
|
+
? (lastMat?.process === 1
|
|
238
|
+
? "Invalidate Process 1 and Change to Job "
|
|
239
|
+
: "Change to Job ") + props.st.changeJobUnique
|
|
236
240
|
: props.st.changeRawMat !== null
|
|
237
|
-
? "Invalidate
|
|
241
|
+
? (lastMat?.process === 1 ? "Invalidate Process 1 and Change to " : "Change to ") +
|
|
242
|
+
props.st.changeRawMat
|
|
238
243
|
: props.st.process !== null
|
|
239
|
-
? props.st.process
|
|
240
|
-
? lastMat && lastMat.process > 1
|
|
241
|
-
? "Invalidate All Processes"
|
|
242
|
-
: "Invalidate Process 1"
|
|
243
|
-
: "Invalidate Process " + props.st.process.toString()
|
|
244
|
+
? "Invalidate Process " + props.st.process.toString()
|
|
244
245
|
: "Invalidate Cycle" })) : undefined] }));
|
|
245
246
|
}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
import { SubmitBasketLoadStationCommand } from "./BasketLoadStationWork.js";
|
|
3
|
-
import { SubmitBasketLocationCorrection, SubmitBasketMovementCompletion } from "./BasketMovementArrival.js";
|
|
4
2
|
interface LoadStationProps {
|
|
5
3
|
readonly loadNum: number;
|
|
6
4
|
readonly queues: ReadonlyArray<string>;
|
|
7
5
|
readonly completed: boolean;
|
|
8
6
|
readonly whiteBackground?: boolean;
|
|
9
|
-
readonly submitBasketLoadStationCommand?: SubmitBasketLoadStationCommand;
|
|
10
|
-
readonly submitBasketMovementCompletion?: SubmitBasketMovementCompletion;
|
|
11
|
-
readonly submitBasketLocationCorrection?: SubmitBasketLocationCorrection;
|
|
12
7
|
}
|
|
13
8
|
export declare function LoadStation(props: LoadStationProps): import("react").JSX.Element;
|
|
14
9
|
declare function LoadStationCheckWidth(props: LoadStationProps): ReactNode;
|