@seedtactics/insight-client 17.0.1-beta.15 → 17.0.1-beta.16
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/dist/assets/{ProgramHighlight-CnZe9PDO.js → ProgramHighlight-mKbZxoXO.js} +1 -1
- package/dist/assets/index-Bb9RtihL.js +367 -0
- package/dist/components/ChooseMode.js +15 -3
- package/dist/components/LoadingIcon.js +3 -1
- package/dist/components/station-monitor/BasketLoadStationWork.d.ts +4 -1
- package/dist/components/station-monitor/BasketLoadStationWork.js +54 -30
- package/dist/components/station-monitor/LoadStation.js +52 -37
- package/dist/components/station-monitor/Material.d.ts +6 -1
- package/dist/components/station-monitor/Material.js +19 -8
- package/dist/components/station-monitor/MoveMaterialArrows.js +9 -0
- package/dist/components/station-monitor/SystemOverview.js +56 -17
- 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/index.html +1 -1
- package/dist/network/websocket.js +23 -4
- package/package.json +13 -13
- package/dist/assets/index-Z6GAS_qc.js +0 -367
|
@@ -170,7 +170,18 @@ function useCellOverview() {
|
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
|
|
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) {
|
|
174
185
|
loads = loads.alter(i, (status) => {
|
|
175
186
|
if (status)
|
|
176
187
|
return status;
|
|
@@ -190,6 +201,16 @@ function useCellOverview() {
|
|
|
190
201
|
if (mat.location.face !== null && mat.location.face !== undefined) {
|
|
191
202
|
maxNumFacesOnPallet = Math.max(maxNumFacesOnPallet, mat.location.face);
|
|
192
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
|
+
}
|
|
193
214
|
}
|
|
194
215
|
let machAtLoad = OrderedMap.empty();
|
|
195
216
|
if (currentSt.machineLocations && currentSt.machineLocations.length > 0) {
|
|
@@ -286,9 +307,19 @@ function useCellOverview() {
|
|
|
286
307
|
}
|
|
287
308
|
}
|
|
288
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;
|
|
289
318
|
const sourceRows = new Map();
|
|
290
|
-
|
|
291
|
-
|
|
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))
|
|
292
323
|
.toRArray();
|
|
293
324
|
for (const mat of sourceMats) {
|
|
294
325
|
if (mat.location.type === LocType.Free) {
|
|
@@ -321,13 +352,6 @@ function useCellOverview() {
|
|
|
321
352
|
sourceRows.set(key, row);
|
|
322
353
|
}
|
|
323
354
|
}
|
|
324
|
-
const currentBasket = LazySeq.of(activeBaskets.get(load.lulNum) ?? [])
|
|
325
|
-
.sortBy((b) => b.basket.position?.locationNum ?? 0)
|
|
326
|
-
.toRArray();
|
|
327
|
-
// Extras beyond the first active basket at this station fall back to floating
|
|
328
|
-
for (const extra of currentBasket.slice(1)) {
|
|
329
|
-
floatingBaskets.set(extra.basket.basketId, extra);
|
|
330
|
-
}
|
|
331
355
|
const loadingFromBasketIds = new Set(LazySeq.of(load.pal?.mats ?? [])
|
|
332
356
|
.collect((mat) => mat.action.loadFromBasketId ?? null)
|
|
333
357
|
.toRArray());
|
|
@@ -431,7 +455,7 @@ function PalletFaces({ maxNumFaces, mats: allMats, loadingOntoPallet, noFilter,
|
|
|
431
455
|
const byFace = loadingOntoPallet
|
|
432
456
|
? LazySeq.of(allMats)
|
|
433
457
|
.filter((m) => noFilter || m.location.type !== LocType.OnPallet)
|
|
434
|
-
.orderedGroupBy((m) => m.action.loadOntoFace ?? 1)
|
|
458
|
+
.orderedGroupBy((m) => m.action.loadOntoFace ?? m.action.loadToBasketSlot ?? 1)
|
|
435
459
|
: LazySeq.of(allMats)
|
|
436
460
|
.filter((m) => noFilter || m.location.type === LocType.OnPallet)
|
|
437
461
|
.orderedGroupBy((m) => m.action.type === ActionType.Loading
|
|
@@ -451,8 +475,23 @@ function PalletFaces({ maxNumFaces, mats: allMats, loadingOntoPallet, noFilter,
|
|
|
451
475
|
}, children: _jsx(MaterialIcon, { mats: mats }) }, face))) }));
|
|
452
476
|
}
|
|
453
477
|
}
|
|
454
|
-
function BasketContents({ mats }) {
|
|
455
|
-
|
|
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
|
+
}
|
|
456
495
|
return (_jsx(Box, { sx: {
|
|
457
496
|
display: "flex",
|
|
458
497
|
flexWrap: "wrap",
|
|
@@ -464,7 +503,7 @@ function BasketContents({ mats }) {
|
|
|
464
503
|
paddingRight: "5px",
|
|
465
504
|
height: "100%",
|
|
466
505
|
alignContent: "center",
|
|
467
|
-
}, children:
|
|
506
|
+
}, children: bySlot.map(([slot, slotMats]) => (_jsx(Box, { children: _jsx(MaterialIcon, { mats: slotMats }) }, slot))) }));
|
|
468
507
|
}
|
|
469
508
|
function SourceRowContents({ mats, maxNumFaces, }) {
|
|
470
509
|
return (_jsx(Box, { sx: {
|
|
@@ -681,7 +720,7 @@ function LoadStation({ maxNumFaces, maxNumStagingRows, maxNumSourceRows, load, }
|
|
|
681
720
|
flexDirection: "column",
|
|
682
721
|
justifyContent: "center",
|
|
683
722
|
borderBottom: "1px solid black",
|
|
684
|
-
}, 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) => {
|
|
685
724
|
const row = load.staging[i] ?? null;
|
|
686
725
|
const isLastRow = i === numStagingRows - 1;
|
|
687
726
|
return (_jsxs(Fragment, { children: [_jsx(Box, { sx: {
|
|
@@ -698,7 +737,7 @@ function LoadStation({ maxNumFaces, maxNumStagingRows, maxNumSourceRows, load, }
|
|
|
698
737
|
display: "flex",
|
|
699
738
|
flexDirection: "column",
|
|
700
739
|
justifyContent: "center",
|
|
701
|
-
}, 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}`));
|
|
702
741
|
})] }));
|
|
703
742
|
}
|
|
704
743
|
function MachineAtLoadLabel({ status }) {
|
|
@@ -790,7 +829,7 @@ function FloatingBasket({ basket }) {
|
|
|
790
829
|
gridArea: "basketname",
|
|
791
830
|
padding: "0.2em",
|
|
792
831
|
borderBottom: "1px solid black",
|
|
793
|
-
}, 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 }) })] }));
|
|
794
833
|
}
|
|
795
834
|
function BasketStorageSummary({ empty, filled }) {
|
|
796
835
|
const basketName = basketDisplayName(useAtomValue(fmsInformation).basketName);
|
|
@@ -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;
|
package/dist/data/move-arrows.js
CHANGED
|
@@ -54,7 +54,7 @@ export function uniqueIdForNodeKind(kind) {
|
|
|
54
54
|
case MoveMaterialNodeKindType.CompletedExpandedMaterialZone:
|
|
55
55
|
return "CompletedExpandedMaterialZone";
|
|
56
56
|
case MoveMaterialNodeKindType.PalletFaceZone:
|
|
57
|
-
return
|
|
57
|
+
return `PalletFaceZone-${kind.palletNum}-${kind.face}`;
|
|
58
58
|
case MoveMaterialNodeKindType.QueueZone:
|
|
59
59
|
return "QueueZone-" + kind.queue;
|
|
60
60
|
case MoveMaterialNodeKindType.BasketZone:
|
|
@@ -72,7 +72,7 @@ export function memoPropsForNodeKind(kind) {
|
|
|
72
72
|
case MoveMaterialNodeKindType.CompletedExpandedMaterialZone:
|
|
73
73
|
return [kind.type, null];
|
|
74
74
|
case MoveMaterialNodeKindType.PalletFaceZone:
|
|
75
|
-
return [kind.type, kind.face];
|
|
75
|
+
return [kind.type, kind.palletNum, kind.face];
|
|
76
76
|
case MoveMaterialNodeKindType.QueueZone:
|
|
77
77
|
return [kind.type, kind.queue];
|
|
78
78
|
case MoveMaterialNodeKindType.BasketZone:
|
|
@@ -81,6 +81,9 @@ export function memoPropsForNodeKind(kind) {
|
|
|
81
81
|
return [kind.type, kind.basketId, kind.slot];
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
+
function faceKey(palletNum, face) {
|
|
85
|
+
return `${palletNum ?? ""}:${face}`;
|
|
86
|
+
}
|
|
84
87
|
function groupMatByKind(allNodes) {
|
|
85
88
|
let freeMaterial;
|
|
86
89
|
let completedMaterial;
|
|
@@ -99,7 +102,7 @@ function groupMatByKind(allNodes) {
|
|
|
99
102
|
completedMaterial = node.elem;
|
|
100
103
|
break;
|
|
101
104
|
case MoveMaterialNodeKindType.PalletFaceZone:
|
|
102
|
-
faces.set(node.face, node.elem);
|
|
105
|
+
faces.set(faceKey(node.palletNum, node.face), node.elem);
|
|
103
106
|
break;
|
|
104
107
|
case MoveMaterialNodeKindType.QueueZone:
|
|
105
108
|
queues.set(node.queue, node.elem);
|
|
@@ -119,6 +122,45 @@ function groupMatByKind(allNodes) {
|
|
|
119
122
|
}
|
|
120
123
|
return { freeMaterial, completedMaterial, faces, queues, baskets, basketSlots, material };
|
|
121
124
|
}
|
|
125
|
+
// All material in a basket slot moves together, so material leaving or staying in a slot draws a
|
|
126
|
+
// single arrow from the combined rectangle of the slot's material. Material arriving from
|
|
127
|
+
// elsewhere keeps an arrow per piece.
|
|
128
|
+
function basketSlotGroup(mat) {
|
|
129
|
+
if (mat.location.type === api.LocType.InBasket &&
|
|
130
|
+
mat.location.basketId !== undefined &&
|
|
131
|
+
mat.location.basketSlot !== undefined) {
|
|
132
|
+
return `${mat.location.basketId}:${mat.location.basketSlot}`;
|
|
133
|
+
}
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
function unionRect(a, b) {
|
|
137
|
+
const left = Math.min(a.left, b.left);
|
|
138
|
+
const top = Math.min(a.top, b.top);
|
|
139
|
+
const right = Math.max(a.right, b.right);
|
|
140
|
+
const bottom = Math.max(a.bottom, b.bottom);
|
|
141
|
+
return { left, top, right, bottom, width: right - left, height: bottom - top };
|
|
142
|
+
}
|
|
143
|
+
function arrowSources(material) {
|
|
144
|
+
const sorted = LazySeq.of(material)
|
|
145
|
+
.sortBy(([box]) => box.left, ([box]) => box.top)
|
|
146
|
+
.toRArray();
|
|
147
|
+
const slotRects = LazySeq.of(sorted)
|
|
148
|
+
.collect(([rect, mat]) => {
|
|
149
|
+
const group = basketSlotGroup(mat);
|
|
150
|
+
return group === null ? null : [group, rect];
|
|
151
|
+
})
|
|
152
|
+
.buildHashMap(([group]) => group, (prev, [, rect]) => (prev ? unionRect(prev, rect) : rect));
|
|
153
|
+
const seen = new Set();
|
|
154
|
+
return sorted.flatMap(([rect, mat]) => {
|
|
155
|
+
const group = basketSlotGroup(mat);
|
|
156
|
+
if (group === null)
|
|
157
|
+
return [[rect, mat]];
|
|
158
|
+
if (seen.has(group))
|
|
159
|
+
return [];
|
|
160
|
+
seen.add(group);
|
|
161
|
+
return [[slotRects.get(group) ?? rect, mat]];
|
|
162
|
+
});
|
|
163
|
+
}
|
|
122
164
|
export function computeArrows(container, allNodes) {
|
|
123
165
|
if (!container) {
|
|
124
166
|
return [];
|
|
@@ -128,11 +170,19 @@ export function computeArrows(container, allNodes) {
|
|
|
128
170
|
return [];
|
|
129
171
|
}
|
|
130
172
|
const arrows = [];
|
|
173
|
+
const loops = [];
|
|
131
174
|
const faceDestUsed = new Map();
|
|
132
175
|
const queueDestUsed = new Map();
|
|
133
176
|
const basketDestUsed = new Map();
|
|
177
|
+
const slotDestUsed = new Map();
|
|
134
178
|
let lastFreeUsed = 0;
|
|
135
|
-
|
|
179
|
+
const sources = arrowSources(byKind.material);
|
|
180
|
+
const slotLoadCounts = LazySeq.of(sources)
|
|
181
|
+
.filter(([, mat]) => mat.action.type === api.ActionType.LoadingToBasket &&
|
|
182
|
+
basketSlotGroup(mat) !== `${mat.action.loadToBasketId}:${mat.action.loadToBasketSlot}`)
|
|
183
|
+
.groupBy(([, mat]) => `${mat.action.loadToBasketId}:${mat.action.loadToBasketSlot}`)
|
|
184
|
+
.toHashMap(([slot, loads]) => [slot, loads.length]);
|
|
185
|
+
for (const [rect, mat] of sources) {
|
|
136
186
|
switch (mat.action.type) {
|
|
137
187
|
case api.ActionType.UnloadToCompletedMaterial:
|
|
138
188
|
case api.ActionType.UnloadToInProcess:
|
|
@@ -185,10 +235,11 @@ export function computeArrows(container, allNodes) {
|
|
|
185
235
|
case api.ActionType.Loading:
|
|
186
236
|
if (mat.action.loadFromBasketId && mat.action.loadOntoFace) {
|
|
187
237
|
// loading from basket onto pallet face
|
|
188
|
-
const
|
|
238
|
+
const key = faceKey(mat.action.loadOntoPalletNum, mat.action.loadOntoFace);
|
|
239
|
+
const face = byKind.faces.get(key);
|
|
189
240
|
if (face !== undefined) {
|
|
190
|
-
const faceSpotsUsed = faceDestUsed.get(
|
|
191
|
-
faceDestUsed.set(
|
|
241
|
+
const faceSpotsUsed = faceDestUsed.get(key) ?? 0;
|
|
242
|
+
faceDestUsed.set(key, faceSpotsUsed + 1);
|
|
192
243
|
arrows.push({
|
|
193
244
|
fromX: rect.right,
|
|
194
245
|
fromY: rect.top + rect.height / 2,
|
|
@@ -226,7 +277,7 @@ export function computeArrows(container, allNodes) {
|
|
|
226
277
|
}
|
|
227
278
|
else {
|
|
228
279
|
// move to different face
|
|
229
|
-
const face = byKind.faces.get(mat.action.loadOntoFace);
|
|
280
|
+
const face = byKind.faces.get(faceKey(mat.action.loadOntoPalletNum, mat.action.loadOntoFace));
|
|
230
281
|
if (face) {
|
|
231
282
|
if (mat.action.loadOntoFace < (mat.location.face ?? 0)) {
|
|
232
283
|
arrows.push({
|
|
@@ -251,10 +302,11 @@ export function computeArrows(container, allNodes) {
|
|
|
251
302
|
}
|
|
252
303
|
else {
|
|
253
304
|
// loading from queues or free Material
|
|
254
|
-
const
|
|
305
|
+
const key = faceKey(mat.action.loadOntoPalletNum, mat.action.loadOntoFace);
|
|
306
|
+
const face = byKind.faces.get(key);
|
|
255
307
|
if (face !== undefined) {
|
|
256
|
-
const faceSpotsUsed = faceDestUsed.get(
|
|
257
|
-
faceDestUsed.set(
|
|
308
|
+
const faceSpotsUsed = faceDestUsed.get(key) ?? 0;
|
|
309
|
+
faceDestUsed.set(key, faceSpotsUsed + 1);
|
|
258
310
|
arrows.push({
|
|
259
311
|
fromX: rect.right,
|
|
260
312
|
fromY: rect.top + rect.height / 2,
|
|
@@ -270,28 +322,59 @@ export function computeArrows(container, allNodes) {
|
|
|
270
322
|
const basketId = mat.action.loadToBasketId;
|
|
271
323
|
if (basketId === undefined)
|
|
272
324
|
break;
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
325
|
+
if (mat.location.type === api.LocType.InBasket &&
|
|
326
|
+
mat.location.basketId === basketId &&
|
|
327
|
+
mat.location.basketSlot === mat.action.loadToBasketSlot) {
|
|
328
|
+
loops.push({
|
|
329
|
+
type: "loop",
|
|
330
|
+
centerX: rect.left - 20 - container.left,
|
|
331
|
+
centerY: rect.top + rect.height / 2 - container.top,
|
|
332
|
+
radius: 12,
|
|
333
|
+
});
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
const slotKey = `${basketId}:${mat.action.loadToBasketSlot}`;
|
|
337
|
+
const slotDest = mat.action.loadToBasketSlot === undefined ? undefined : byKind.basketSlots.get(slotKey);
|
|
338
|
+
if (slotDest !== undefined) {
|
|
339
|
+
// Keep arrowheads in the margin before the row so cards cannot cover them. Multiple
|
|
340
|
+
// arrivals are spread vertically within the row's height.
|
|
341
|
+
const spotsUsed = slotDestUsed.get(slotKey) ?? 0;
|
|
342
|
+
slotDestUsed.set(slotKey, spotsUsed + 1);
|
|
343
|
+
arrows.push({
|
|
344
|
+
fromX: rect.right,
|
|
345
|
+
fromY: rect.top + rect.height / 2,
|
|
346
|
+
toX: slotDest.left - 20,
|
|
347
|
+
toY: slotDest.top +
|
|
348
|
+
(slotDest.height * (spotsUsed + 1)) / ((slotLoadCounts.get(slotKey) ?? 1) + 1),
|
|
349
|
+
curveDirection: -1,
|
|
350
|
+
});
|
|
351
|
+
break;
|
|
352
|
+
}
|
|
353
|
+
const dest = byKind.baskets.get(basketId);
|
|
354
|
+
if (dest === undefined)
|
|
355
|
+
break;
|
|
277
356
|
const lastSlotUsed = basketDestUsed.get(basketId) ?? 0;
|
|
278
357
|
basketDestUsed.set(basketId, lastSlotUsed + 1);
|
|
279
358
|
arrows.push({
|
|
280
359
|
fromX: rect.right,
|
|
281
360
|
fromY: rect.top + rect.height / 2,
|
|
282
|
-
toX: dest
|
|
283
|
-
toY: dest
|
|
361
|
+
toX: dest.left + 20,
|
|
362
|
+
toY: dest.top + 50 + 20 * lastSlotUsed,
|
|
284
363
|
curveDirection: -1,
|
|
285
364
|
});
|
|
286
365
|
break;
|
|
287
366
|
}
|
|
288
367
|
}
|
|
289
368
|
}
|
|
290
|
-
return
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
369
|
+
return [
|
|
370
|
+
...arrows.map((arr) => ({
|
|
371
|
+
type: "curve",
|
|
372
|
+
fromX: arr.fromX - container.left,
|
|
373
|
+
fromY: arr.fromY - container.top,
|
|
374
|
+
toX: arr.toX - container.left,
|
|
375
|
+
toY: arr.toY - container.top,
|
|
376
|
+
curveDirection: arr.curveDirection,
|
|
377
|
+
})),
|
|
378
|
+
...loops,
|
|
379
|
+
];
|
|
297
380
|
}
|
|
@@ -30,6 +30,7 @@ export declare function extractJobRawMaterial(jobs: {
|
|
|
30
30
|
[key: string]: Readonly<api.IActiveJob>;
|
|
31
31
|
}, mats: Iterable<Readonly<api.IInProcessMaterial>>, queue: string): ReadonlyArray<JobRawMaterialData>;
|
|
32
32
|
export type MaterialList = ReadonlyArray<Readonly<api.IInProcessMaterial>>;
|
|
33
|
+
export declare function groupInterchangeableMaterial(material: MaterialList, canGroup: (m: Readonly<api.IInProcessMaterial>) => boolean): ReadonlyArray<MaterialList>;
|
|
33
34
|
export interface QueueRawMaterialGroup {
|
|
34
35
|
readonly partOrCasting: string;
|
|
35
36
|
readonly assignedJobUnique: string | null;
|
|
@@ -31,7 +31,7 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
31
31
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
32
32
|
*/
|
|
33
33
|
import * as api from "../network/api.js";
|
|
34
|
-
import { LazySeq
|
|
34
|
+
import { LazySeq } from "@seedtactics/immutable-collections";
|
|
35
35
|
import { LogBackend } from "../network/backend.js";
|
|
36
36
|
import { differenceInSeconds } from "date-fns";
|
|
37
37
|
import { useAtomValue } from "jotai";
|
|
@@ -152,6 +152,46 @@ export function extractJobRawMaterial(jobs, mats, queue) {
|
|
|
152
152
|
return prec;
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
|
+
function hasSerial(m) {
|
|
156
|
+
return m.serial !== undefined && m.serial !== null && m.serial !== "";
|
|
157
|
+
}
|
|
158
|
+
function interchangeableKey(m) {
|
|
159
|
+
return [
|
|
160
|
+
m.partName,
|
|
161
|
+
m.jobUnique,
|
|
162
|
+
m.process,
|
|
163
|
+
m.action.type,
|
|
164
|
+
m.action.loadOntoPalletNum,
|
|
165
|
+
m.action.loadOntoFace,
|
|
166
|
+
m.action.loadToBasketId,
|
|
167
|
+
m.action.loadToBasketSlot,
|
|
168
|
+
m.action.processAfterLoad,
|
|
169
|
+
m.action.pathAfterLoad,
|
|
170
|
+
].join("|");
|
|
171
|
+
}
|
|
172
|
+
// Material without a serial is interchangeable with others of the same part, job, process, and
|
|
173
|
+
// destination, so it is displayed as one card with a count. Groups the material selected by
|
|
174
|
+
// canGroup in order of first appearance; other material is returned individually.
|
|
175
|
+
export function groupInterchangeableMaterial(material, canGroup) {
|
|
176
|
+
const groupKey = (m) => canGroup(m) && !hasSerial(m) ? interchangeableKey(m) : null;
|
|
177
|
+
const groups = LazySeq.of(material)
|
|
178
|
+
.collect((m) => {
|
|
179
|
+
const key = groupKey(m);
|
|
180
|
+
return key === null ? null : [key, m];
|
|
181
|
+
})
|
|
182
|
+
.groupBy(([key]) => key)
|
|
183
|
+
.toHashMap(([key, entries]) => [key, entries.map(([, m]) => m)]);
|
|
184
|
+
const seen = new Set();
|
|
185
|
+
return material.flatMap((m) => {
|
|
186
|
+
const key = groupKey(m);
|
|
187
|
+
if (key === null)
|
|
188
|
+
return [[m]];
|
|
189
|
+
if (seen.has(key))
|
|
190
|
+
return [];
|
|
191
|
+
seen.add(key);
|
|
192
|
+
return [groups.get(key) ?? [m]];
|
|
193
|
+
});
|
|
194
|
+
}
|
|
155
195
|
export function selectQueueData(queuesToCheck, curSt, rawMatQueues, inProcQueues) {
|
|
156
196
|
const queues = [];
|
|
157
197
|
const queueNames = [...queuesToCheck];
|
|
@@ -159,58 +199,25 @@ export function selectQueueData(queuesToCheck, curSt, rawMatQueues, inProcQueues
|
|
|
159
199
|
for (const queueName of queueNames) {
|
|
160
200
|
const isRawMat = rawMatQueues.has(queueName);
|
|
161
201
|
if (isRawMat) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
let matsForPart = matByPartThenUniq.get(m.partName);
|
|
173
|
-
if (!matsForPart) {
|
|
174
|
-
matsForPart = new Map();
|
|
175
|
-
matByPartThenUniq.set(m.partName, matsForPart);
|
|
176
|
-
}
|
|
177
|
-
const uniq = m.jobUnique || null;
|
|
178
|
-
const matsForJob = matsForPart.get(uniq);
|
|
179
|
-
if (matsForJob) {
|
|
180
|
-
matsForJob.push(m);
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
matsForPart.set(uniq, [m]);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
const matGroups = [];
|
|
189
|
-
for (const [partName, matsForPart] of matByPartThenUniq) {
|
|
190
|
-
for (const [uniq, mats] of matsForPart) {
|
|
191
|
-
matGroups.push({
|
|
192
|
-
partOrCasting: partName,
|
|
193
|
-
assignedJobUnique: uniq,
|
|
194
|
-
material: mats,
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
matGroups.sort((x, y) => {
|
|
199
|
-
const c1 = x.partOrCasting.localeCompare(y.partOrCasting);
|
|
200
|
-
if (c1 === 0) {
|
|
201
|
-
return (x.assignedJobUnique || "").localeCompare(y.assignedJobUnique || "");
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
return c1;
|
|
205
|
-
}
|
|
206
|
-
});
|
|
202
|
+
const inQueue = LazySeq.of(curSt.material)
|
|
203
|
+
.filter((m) => m.location.type === api.LocType.InQueue &&
|
|
204
|
+
m.location.currentQueue === queueName &&
|
|
205
|
+
m.location.queuePosition !== undefined)
|
|
206
|
+
.toSortedArray((m) => m.location.queuePosition ?? 0);
|
|
207
|
+
// material with a serial or an action keeps its own card and queue position
|
|
208
|
+
const waitingWithoutSerial = (m) => !hasSerial(m) && m.action.type === api.ActionType.Waiting;
|
|
209
|
+
const matGroups = LazySeq.of(groupInterchangeableMaterial(inQueue.filter(waitingWithoutSerial), () => true)).toSortedArray((g) => g[0].partName, (g) => g[0].jobUnique ?? "");
|
|
207
210
|
queues.push({
|
|
208
211
|
label: queueName,
|
|
209
212
|
free: false,
|
|
210
213
|
rawMaterialQueue: true,
|
|
211
214
|
inProcQueue: false,
|
|
212
|
-
material:
|
|
213
|
-
groupedRawMat: matGroups
|
|
215
|
+
material: inQueue.filter((m) => !waitingWithoutSerial(m)),
|
|
216
|
+
groupedRawMat: matGroups.map((material) => ({
|
|
217
|
+
partOrCasting: material[0].partName,
|
|
218
|
+
assignedJobUnique: material[0].jobUnique || null,
|
|
219
|
+
material,
|
|
220
|
+
})),
|
|
214
221
|
});
|
|
215
222
|
}
|
|
216
223
|
else {
|
package/dist/index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<link rel="shortcut icon" href="/assets/favicon-gWFxiJK2.ico" />
|
|
7
7
|
<title>SeedTactic FMS Insight</title>
|
|
8
8
|
<style type="text/css">.download-loader{width:100px;height:100px;display:inline-block}.download-circular{width:100px;height:100px;animation:2s linear infinite rotate}.download-path{stroke-dasharray:1 200;stroke-dashoffset:0;stroke-linecap:round;stroke:#8d6e63;animation:1.5s ease-out infinite dash}@keyframes rotate{to{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1 200;stroke-dashoffset:0}50%{stroke-dasharray:89 200;stroke-dashoffset:-35px}to{stroke-dasharray:89 200;stroke-dashoffset:-124px}}</style>
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-Bb9RtihL.js"></script>
|
|
10
10
|
<link rel="stylesheet" crossorigin href="/assets/index-DXfAwuj-.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
|
@@ -30,7 +30,7 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
30
30
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
31
31
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
32
32
|
*/
|
|
33
|
-
import { ServerEvent } from "./api.js";
|
|
33
|
+
import { ApiException, ServerEvent } from "./api.js";
|
|
34
34
|
import { JobsBackend, LogBackend } from "./backend.js";
|
|
35
35
|
import { fmsInformation } from "./server-settings.js";
|
|
36
36
|
import { useEffect, useRef } from "react";
|
|
@@ -59,6 +59,24 @@ export const errorLoadingLast30 = atom((get) => get(errorLoadingLast30RW) ?? get
|
|
|
59
59
|
function isCurrentSession(get, session) {
|
|
60
60
|
return get(websocketSessionAtom).id === session;
|
|
61
61
|
}
|
|
62
|
+
function loadingErrorMessage(error, fallback) {
|
|
63
|
+
if (error !== null && typeof error === "object" && ApiException.isApiException(error)) {
|
|
64
|
+
try {
|
|
65
|
+
const problem = JSON.parse(error.response);
|
|
66
|
+
if (problem !== null &&
|
|
67
|
+
typeof problem === "object" &&
|
|
68
|
+
"detail" in problem &&
|
|
69
|
+
typeof problem.detail === "string" &&
|
|
70
|
+
problem.detail.trim().length > 0) {
|
|
71
|
+
return problem.detail;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// Older servers can return plain text or HTML instead of a JSON problem.
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return error instanceof Error ? error.message : fallback;
|
|
79
|
+
}
|
|
62
80
|
function loadCurrentStatus(get, set, session) {
|
|
63
81
|
return JobsBackend.currentStatus().then((st) => {
|
|
64
82
|
const current = get(websocketSessionAtom);
|
|
@@ -83,7 +101,7 @@ function loadHistory(get, set, session, from, retryDelay = 1000) {
|
|
|
83
101
|
}, (e) => {
|
|
84
102
|
if (!isCurrentSession(get, session))
|
|
85
103
|
return;
|
|
86
|
-
set(errorLoadingLogRW, e
|
|
104
|
+
set(errorLoadingLogRW, loadingErrorMessage(e, "Error loading log history"));
|
|
87
105
|
// Keep buffering and retry from the same applied position without interrupting live status.
|
|
88
106
|
setTimeout(() => {
|
|
89
107
|
if (isCurrentSession(get, session)) {
|
|
@@ -106,8 +124,9 @@ function loadConnection(get, set, session) {
|
|
|
106
124
|
function finishLoading(loads, get, set, session) {
|
|
107
125
|
Promise.all(loads)
|
|
108
126
|
.catch((e) => {
|
|
109
|
-
if (isCurrentSession(get, session))
|
|
110
|
-
set(errorLoadingLast30RW, e
|
|
127
|
+
if (isCurrentSession(get, session)) {
|
|
128
|
+
set(errorLoadingLast30RW, loadingErrorMessage(e, "Error"));
|
|
129
|
+
}
|
|
111
130
|
})
|
|
112
131
|
.finally(() => {
|
|
113
132
|
if (isCurrentSession(get, session))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seedtactics/insight-client",
|
|
3
|
-
"version": "17.0.1-beta.
|
|
3
|
+
"version": "17.0.1-beta.16",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/SeedTactics/fms-insight"
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"@emotion/react": "^11.14.0",
|
|
29
29
|
"@emotion/styled": "^11.14.1",
|
|
30
30
|
"@fontsource/roboto": "^5.3.0",
|
|
31
|
-
"@mui/icons-material": "^9.
|
|
32
|
-
"@mui/material": "^9.
|
|
31
|
+
"@mui/icons-material": "^9.5.0",
|
|
32
|
+
"@mui/material": "^9.5.0",
|
|
33
33
|
"@react-spring/rafz": "^10.1.2",
|
|
34
34
|
"@react-spring/web": "^10.1.2",
|
|
35
35
|
"@seedtactics/immutable-collections": "^1.1.1",
|
|
@@ -58,23 +58,23 @@
|
|
|
58
58
|
"@types/d3-sankey": "^0.12.5",
|
|
59
59
|
"@types/d3-scale": "^4.0.9",
|
|
60
60
|
"@types/d3-shape": "^3.2.0",
|
|
61
|
-
"@types/node": "^26.6.
|
|
61
|
+
"@types/node": "^26.6.5",
|
|
62
62
|
"@types/react": "^19.3.0",
|
|
63
63
|
"@types/react-dom": "^19.3.0",
|
|
64
|
-
"@vitejs/plugin-react": "^6.1.
|
|
65
|
-
"@vitest/browser-playwright": "^5.0.
|
|
64
|
+
"@vitejs/plugin-react": "^6.1.2",
|
|
65
|
+
"@vitest/browser-playwright": "^5.0.4",
|
|
66
66
|
"jotai": "^3.0.1",
|
|
67
|
-
"jsdom": "^30.1.
|
|
67
|
+
"jsdom": "^30.1.2",
|
|
68
68
|
"nswag": "^14.7.1",
|
|
69
|
-
"oxfmt": "^0.
|
|
70
|
-
"oxlint": "^1.
|
|
71
|
-
"oxlint-tsgolint": "^7.0.
|
|
72
|
-
"playwright": "^1.
|
|
69
|
+
"oxfmt": "^0.73.0",
|
|
70
|
+
"oxlint": "^1.88.0",
|
|
71
|
+
"oxlint-tsgolint": "^7.0.2004",
|
|
72
|
+
"playwright": "^1.64.0",
|
|
73
73
|
"react": "^19.3.0",
|
|
74
74
|
"react-dom": "^19.3.0",
|
|
75
75
|
"typescript": "^7.0.2",
|
|
76
|
-
"vite": "^8.3.
|
|
77
|
-
"vitest": "^5.0.
|
|
76
|
+
"vite": "^8.3.4",
|
|
77
|
+
"vitest": "^5.0.4",
|
|
78
78
|
"vitest-browser-react": "^2.3.0"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|