@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
package/dist/network/api.js
CHANGED
|
@@ -393,6 +393,40 @@ export class JobsClient {
|
|
|
393
393
|
}
|
|
394
394
|
return Promise.resolve(null);
|
|
395
395
|
}
|
|
396
|
+
completeBasketLoadStation(completion, signal) {
|
|
397
|
+
let url_ = this.baseUrl + "/api/v1/jobs/basket-load-station/complete";
|
|
398
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
399
|
+
const content_ = JSON.stringify(completion);
|
|
400
|
+
let options_ = {
|
|
401
|
+
body: content_,
|
|
402
|
+
method: "POST",
|
|
403
|
+
signal,
|
|
404
|
+
headers: {
|
|
405
|
+
"Content-Type": "application/json",
|
|
406
|
+
},
|
|
407
|
+
};
|
|
408
|
+
return this.http.fetch(url_, options_).then((_response) => {
|
|
409
|
+
return this.processCompleteBasketLoadStation(_response);
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
processCompleteBasketLoadStation(response) {
|
|
413
|
+
const status = response.status;
|
|
414
|
+
let _headers = {};
|
|
415
|
+
if (response.headers && response.headers.forEach) {
|
|
416
|
+
response.headers.forEach((v, k) => (_headers[k] = v));
|
|
417
|
+
}
|
|
418
|
+
if (status === 200) {
|
|
419
|
+
return response.text().then((_responseText) => {
|
|
420
|
+
return;
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
else if (status !== 200 && status !== 204) {
|
|
424
|
+
return response.text().then((_responseText) => {
|
|
425
|
+
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
return Promise.resolve(null);
|
|
429
|
+
}
|
|
396
430
|
currentStatus(signal) {
|
|
397
431
|
let url_ = this.baseUrl + "/api/v1/jobs/status";
|
|
398
432
|
url_ = url_.replace(/[?&]$/, "");
|
|
@@ -3625,11 +3659,6 @@ export class CurrentStatus {
|
|
|
3625
3659
|
: new BasketStatus();
|
|
3626
3660
|
}
|
|
3627
3661
|
}
|
|
3628
|
-
if (Array.isArray(_data["BasketMoveInstructions"])) {
|
|
3629
|
-
this.basketMoveInstructions = [];
|
|
3630
|
-
for (let item of _data["BasketMoveInstructions"])
|
|
3631
|
-
this.basketMoveInstructions.push(BasketMoveInstruction.fromJS(item));
|
|
3632
|
-
}
|
|
3633
3662
|
this.customState = _data["CustomState"];
|
|
3634
3663
|
}
|
|
3635
3664
|
}
|
|
@@ -3700,11 +3729,6 @@ export class CurrentStatus {
|
|
|
3700
3729
|
: undefined;
|
|
3701
3730
|
}
|
|
3702
3731
|
}
|
|
3703
|
-
if (Array.isArray(this.basketMoveInstructions)) {
|
|
3704
|
-
data["BasketMoveInstructions"] = [];
|
|
3705
|
-
for (let item of this.basketMoveInstructions)
|
|
3706
|
-
data["BasketMoveInstructions"].push(item ? item.toJSON() : undefined);
|
|
3707
|
-
}
|
|
3708
3732
|
data["CustomState"] = this.customState;
|
|
3709
3733
|
return data;
|
|
3710
3734
|
}
|
|
@@ -4050,6 +4074,7 @@ export class InProcessMaterialAction {
|
|
|
4050
4074
|
init(_data) {
|
|
4051
4075
|
if (_data) {
|
|
4052
4076
|
this.type = _data["Type"];
|
|
4077
|
+
this.automatedTransfer = _data["AutomatedTransfer"];
|
|
4053
4078
|
this.workId = _data["WorkId"];
|
|
4054
4079
|
this.loadCancellationId = _data["LoadCancellationId"];
|
|
4055
4080
|
this.loadOntoPalletNum = _data["LoadOntoPalletNum"];
|
|
@@ -4077,6 +4102,7 @@ export class InProcessMaterialAction {
|
|
|
4077
4102
|
toJSON(data) {
|
|
4078
4103
|
data = typeof data === "object" ? data : {};
|
|
4079
4104
|
data["Type"] = this.type;
|
|
4105
|
+
data["AutomatedTransfer"] = this.automatedTransfer;
|
|
4080
4106
|
data["WorkId"] = this.workId;
|
|
4081
4107
|
data["LoadCancellationId"] = this.loadCancellationId;
|
|
4082
4108
|
data["LoadOntoPalletNum"] = this.loadOntoPalletNum;
|
|
@@ -4365,6 +4391,7 @@ export class BasketStatus {
|
|
|
4365
4391
|
init(_data) {
|
|
4366
4392
|
if (_data) {
|
|
4367
4393
|
this.basketId = _data["BasketId"];
|
|
4394
|
+
this.slotCount = _data["SlotCount"];
|
|
4368
4395
|
this.loadStationWork = _data["LoadStationWork"]
|
|
4369
4396
|
? BasketLoadStationWork.fromJS(_data["LoadStationWork"])
|
|
4370
4397
|
: undefined;
|
|
@@ -4392,6 +4419,7 @@ export class BasketStatus {
|
|
|
4392
4419
|
toJSON(data) {
|
|
4393
4420
|
data = typeof data === "object" ? data : {};
|
|
4394
4421
|
data["BasketId"] = this.basketId;
|
|
4422
|
+
data["SlotCount"] = this.slotCount;
|
|
4395
4423
|
data["LoadStationWork"] = this.loadStationWork
|
|
4396
4424
|
? this.loadStationWork.toJSON()
|
|
4397
4425
|
: undefined;
|
|
@@ -4424,6 +4452,7 @@ export class BasketLoadStationWork {
|
|
|
4424
4452
|
this.type = _data["Type"];
|
|
4425
4453
|
this.readyToConfirm = _data["ReadyToConfirm"];
|
|
4426
4454
|
this.confirmationBlockedReason = _data["ConfirmationBlockedReason"];
|
|
4455
|
+
this.instructionWarning = _data["InstructionWarning"];
|
|
4427
4456
|
if (Array.isArray(_data["AwaitingMaterialSlots"])) {
|
|
4428
4457
|
this.awaitingMaterialSlots = [];
|
|
4429
4458
|
for (let item of _data["AwaitingMaterialSlots"])
|
|
@@ -4443,6 +4472,7 @@ export class BasketLoadStationWork {
|
|
|
4443
4472
|
data["Type"] = this.type;
|
|
4444
4473
|
data["ReadyToConfirm"] = this.readyToConfirm;
|
|
4445
4474
|
data["ConfirmationBlockedReason"] = this.confirmationBlockedReason;
|
|
4475
|
+
data["InstructionWarning"] = this.instructionWarning;
|
|
4446
4476
|
if (Array.isArray(this.awaitingMaterialSlots)) {
|
|
4447
4477
|
data["AwaitingMaterialSlots"] = [];
|
|
4448
4478
|
for (let item of this.awaitingMaterialSlots)
|
|
@@ -4495,60 +4525,6 @@ export var BasketLocationEnum;
|
|
|
4495
4525
|
BasketLocationEnum["Storage"] = "Storage";
|
|
4496
4526
|
BasketLocationEnum["InTransit"] = "InTransit";
|
|
4497
4527
|
})(BasketLocationEnum || (BasketLocationEnum = {}));
|
|
4498
|
-
export class BasketMoveInstruction {
|
|
4499
|
-
constructor(data) {
|
|
4500
|
-
if (data) {
|
|
4501
|
-
for (var property in data) {
|
|
4502
|
-
if (data.hasOwnProperty(property))
|
|
4503
|
-
this[property] = data[property];
|
|
4504
|
-
}
|
|
4505
|
-
}
|
|
4506
|
-
if (!data) {
|
|
4507
|
-
this.destination = new BasketPosition();
|
|
4508
|
-
}
|
|
4509
|
-
}
|
|
4510
|
-
init(_data) {
|
|
4511
|
-
if (_data) {
|
|
4512
|
-
this.instructionId = _data["InstructionId"];
|
|
4513
|
-
this.basketId = _data["BasketId"];
|
|
4514
|
-
this.source = _data["Source"] ? BasketPosition.fromJS(_data["Source"]) : undefined;
|
|
4515
|
-
this.destination = _data["Destination"]
|
|
4516
|
-
? BasketPosition.fromJS(_data["Destination"])
|
|
4517
|
-
: new BasketPosition();
|
|
4518
|
-
this.reason = _data["Reason"];
|
|
4519
|
-
this.displayText = _data["DisplayText"];
|
|
4520
|
-
this.prerequisiteInstructionId = _data["PrerequisiteInstructionId"];
|
|
4521
|
-
}
|
|
4522
|
-
}
|
|
4523
|
-
static fromJS(data) {
|
|
4524
|
-
data = typeof data === "object" ? data : {};
|
|
4525
|
-
let result = new BasketMoveInstruction();
|
|
4526
|
-
result.init(data);
|
|
4527
|
-
return result;
|
|
4528
|
-
}
|
|
4529
|
-
toJSON(data) {
|
|
4530
|
-
data = typeof data === "object" ? data : {};
|
|
4531
|
-
data["InstructionId"] = this.instructionId;
|
|
4532
|
-
data["BasketId"] = this.basketId;
|
|
4533
|
-
data["Source"] = this.source ? this.source.toJSON() : undefined;
|
|
4534
|
-
data["Destination"] = this.destination ? this.destination.toJSON() : undefined;
|
|
4535
|
-
data["Reason"] = this.reason;
|
|
4536
|
-
data["DisplayText"] = this.displayText;
|
|
4537
|
-
data["PrerequisiteInstructionId"] = this.prerequisiteInstructionId;
|
|
4538
|
-
return data;
|
|
4539
|
-
}
|
|
4540
|
-
}
|
|
4541
|
-
export var BasketMoveReason;
|
|
4542
|
-
(function (BasketMoveReason) {
|
|
4543
|
-
BasketMoveReason["LoadMaterial"] = "LoadMaterial";
|
|
4544
|
-
BasketMoveReason["UnloadMaterial"] = "UnloadMaterial";
|
|
4545
|
-
BasketMoveReason["ProcessTransfer"] = "ProcessTransfer";
|
|
4546
|
-
BasketMoveReason["SupplyMaterialToCell"] = "SupplyMaterialToCell";
|
|
4547
|
-
BasketMoveReason["SupplyEmptyBasket"] = "SupplyEmptyBasket";
|
|
4548
|
-
BasketMoveReason["ReturnToStorage"] = "ReturnToStorage";
|
|
4549
|
-
BasketMoveReason["RemoveForCorrection"] = "RemoveForCorrection";
|
|
4550
|
-
BasketMoveReason["Other"] = "Other";
|
|
4551
|
-
})(BasketMoveReason || (BasketMoveReason = {}));
|
|
4552
4528
|
export class ProblemDetails {
|
|
4553
4529
|
constructor(data) {
|
|
4554
4530
|
if (data) {
|
|
@@ -5003,6 +4979,32 @@ export class Rebooking {
|
|
|
5003
4979
|
return data;
|
|
5004
4980
|
}
|
|
5005
4981
|
}
|
|
4982
|
+
export class BasketLoadStationCompletion {
|
|
4983
|
+
constructor(data) {
|
|
4984
|
+
if (data) {
|
|
4985
|
+
for (var property in data) {
|
|
4986
|
+
if (data.hasOwnProperty(property))
|
|
4987
|
+
this[property] = data[property];
|
|
4988
|
+
}
|
|
4989
|
+
}
|
|
4990
|
+
}
|
|
4991
|
+
init(_data) {
|
|
4992
|
+
if (_data) {
|
|
4993
|
+
this.workId = _data["WorkId"];
|
|
4994
|
+
}
|
|
4995
|
+
}
|
|
4996
|
+
static fromJS(data) {
|
|
4997
|
+
data = typeof data === "object" ? data : {};
|
|
4998
|
+
let result = new BasketLoadStationCompletion();
|
|
4999
|
+
result.init(data);
|
|
5000
|
+
return result;
|
|
5001
|
+
}
|
|
5002
|
+
toJSON(data) {
|
|
5003
|
+
data = typeof data === "object" ? data : {};
|
|
5004
|
+
data["WorkId"] = this.workId;
|
|
5005
|
+
return data;
|
|
5006
|
+
}
|
|
5007
|
+
}
|
|
5006
5008
|
export class SimulationResults {
|
|
5007
5009
|
constructor(data) {
|
|
5008
5010
|
if (data) {
|
|
@@ -229,6 +229,9 @@ export function registerMockBackend(offsetSeconds, mockD, mockEvts) {
|
|
|
229
229
|
quarantineQueuedMaterial() {
|
|
230
230
|
return Promise.resolve();
|
|
231
231
|
},
|
|
232
|
+
completeBasketLoadStation() {
|
|
233
|
+
return Promise.resolve();
|
|
234
|
+
},
|
|
232
235
|
cancelLoad() {
|
|
233
236
|
return Promise.resolve();
|
|
234
237
|
},
|
|
@@ -12,6 +12,7 @@ export interface JobAPI {
|
|
|
12
12
|
addUnallocatedCastingToQueue(castingName: string, queue: string, qty: number, operatrorName: string | null, workorder: string | null, serials: string[]): Promise<ReadonlyArray<Readonly<api.IInProcessMaterial>>>;
|
|
13
13
|
signalMaterialForQuarantine(materialId: number, operName: string | null, reason: string | undefined): Promise<void>;
|
|
14
14
|
quarantineQueuedMaterial(materialId: number, operName: string | null, reason: string | undefined): Promise<void>;
|
|
15
|
+
completeBasketLoadStation(request: Readonly<api.IBasketLoadStationCompletion>): Promise<void>;
|
|
15
16
|
cancelLoad(materialId: number, operName: string | null, request: Readonly<api.ICancelLoadRequest>): Promise<void>;
|
|
16
17
|
invalidatePalletCycle(materialId: number, operName: string | null | undefined, changeCastingTo: string | null | undefined, changeJobUniqueTo: string | null | undefined, process: number): Promise<Readonly<api.IMaterialDetails> | null | undefined>;
|
|
17
18
|
unscheduledRebookings(signal?: AbortSignal): Promise<ReadonlyArray<Readonly<api.IRebooking>> | null>;
|
|
@@ -31,38 +31,94 @@ 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 { ServerEvent } from "./api.js";
|
|
34
|
+
import { apiErrorMessage } from "./api-errors.js";
|
|
34
35
|
import { JobsBackend, LogBackend } from "./backend.js";
|
|
35
36
|
import { fmsInformation } from "./server-settings.js";
|
|
36
|
-
import {
|
|
37
|
-
import { lastEventCounter, onLoadCurrentSt, onLoadLast30Jobs, onLoadLast30Log,
|
|
37
|
+
import { useEffect, useRef } from "react";
|
|
38
|
+
import { lastEventCounter, onLoadCurrentSt, onLoadLast30Jobs, onLoadLast30Log, onLiveServerEvent, onHistoricalServerEvent, } from "../cell-status/loading.js";
|
|
38
39
|
import { addDays } from "date-fns";
|
|
39
40
|
import { last30SchIds } from "../cell-status/scheduled-jobs.js";
|
|
41
|
+
import { HashSet, OrderedMap } from "@seedtactics/immutable-collections";
|
|
40
42
|
import { atom, useAtomValue, useSetAtom } from "jotai";
|
|
41
43
|
const websocketReconnectingAtom = atom(false);
|
|
42
44
|
export const websocketReconnecting = websocketReconnectingAtom;
|
|
45
|
+
// True while the websocket is open and this connection has loaded or received a current status, so
|
|
46
|
+
// the retained current status reflects the server. Loading the historical jobs and log does not
|
|
47
|
+
// affect it.
|
|
48
|
+
const currentStatusIsLiveRW = atom(false);
|
|
49
|
+
export const currentStatusIsLive = currentStatusIsLiveRW;
|
|
50
|
+
const websocketSessionAtom = atom({ id: 0, statusFromSocket: false });
|
|
51
|
+
// Only historical effects wait for HTTP catch-up. A fresh session discards its predecessor's
|
|
52
|
+
// unapplied buffer and reloads from lastEventCounter, which has not advanced past that history.
|
|
53
|
+
const bufferedLogAtom = atom(null);
|
|
54
|
+
// HTTP can include entries whose socket messages arrive after the response. Suppress those exact
|
|
55
|
+
// identities, never all counters below a maximum: live publication is not guaranteed to be ordered.
|
|
56
|
+
const loadedLogCountersAtom = atom(HashSet.empty());
|
|
43
57
|
const errorLoadingLast30RW = atom(null);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
.
|
|
53
|
-
|
|
58
|
+
const errorLoadingLogRW = atom(null);
|
|
59
|
+
export const errorLoadingLast30 = atom((get) => get(errorLoadingLast30RW) ?? get(errorLoadingLogRW));
|
|
60
|
+
function isCurrentSession(get, session) {
|
|
61
|
+
return get(websocketSessionAtom).id === session;
|
|
62
|
+
}
|
|
63
|
+
function loadCurrentStatus(get, set, session) {
|
|
64
|
+
return JobsBackend.currentStatus().then((st) => {
|
|
65
|
+
const current = get(websocketSessionAtom);
|
|
66
|
+
if (current.id !== session || current.statusFromSocket)
|
|
67
|
+
return;
|
|
68
|
+
set(onLoadCurrentSt, st);
|
|
69
|
+
set(currentStatusIsLiveRW, true);
|
|
70
|
+
});
|
|
54
71
|
}
|
|
55
|
-
function
|
|
72
|
+
function loadHistory(get, set, session, from, retryDelay = 1000) {
|
|
56
73
|
const now = new Date();
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
.
|
|
74
|
+
const request = from === null ? LogBackend.get(addDays(now, -30), now) : LogBackend.recent(from, undefined);
|
|
75
|
+
return request.then((log) => {
|
|
76
|
+
if (!isCurrentSession(get, session))
|
|
77
|
+
return;
|
|
78
|
+
const buffered = get(bufferedLogAtom) ?? OrderedMap.empty();
|
|
79
|
+
const merged = log.reduce((entries, entry) => entries.set(entry.counter, entry), buffered);
|
|
80
|
+
set(onLoadLast30Log, merged.valuesToAscLazySeq().toRArray());
|
|
81
|
+
set(loadedLogCountersAtom, HashSet.from(merged.keys()));
|
|
82
|
+
set(bufferedLogAtom, null);
|
|
83
|
+
set(errorLoadingLogRW, null);
|
|
84
|
+
}, (e) => {
|
|
85
|
+
if (!isCurrentSession(get, session))
|
|
86
|
+
return;
|
|
87
|
+
set(errorLoadingLogRW, apiErrorMessage(e, "Error loading log history"));
|
|
88
|
+
// Keep buffering and retry from the same applied position without interrupting live status.
|
|
89
|
+
setTimeout(() => {
|
|
90
|
+
if (isCurrentSession(get, session)) {
|
|
91
|
+
void loadHistory(get, set, session, from, Math.min(retryDelay * 2, 30000));
|
|
92
|
+
}
|
|
93
|
+
}, retryDelay);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function loadConnection(get, set, session) {
|
|
97
|
+
const from = get(lastEventCounter);
|
|
98
|
+
const schIds = get(last30SchIds);
|
|
99
|
+
const curStProm = loadCurrentStatus(get, set, session);
|
|
100
|
+
const jobsProm = JobsBackend.recent(addDays(new Date(), -30), from !== null && schIds ? Array.from(schIds) : []).then((j) => {
|
|
101
|
+
if (isCurrentSession(get, session))
|
|
102
|
+
set(onLoadLast30Jobs, j);
|
|
103
|
+
});
|
|
104
|
+
const logProm = loadHistory(get, set, session, from);
|
|
105
|
+
finishLoading([curStProm, jobsProm, logProm], get, set, session);
|
|
106
|
+
}
|
|
107
|
+
function finishLoading(loads, get, set, session) {
|
|
108
|
+
Promise.all(loads)
|
|
109
|
+
.catch((e) => {
|
|
110
|
+
if (isCurrentSession(get, session)) {
|
|
111
|
+
set(errorLoadingLast30RW, apiErrorMessage(e, "Error"));
|
|
112
|
+
}
|
|
113
|
+
})
|
|
114
|
+
.finally(() => {
|
|
115
|
+
if (isCurrentSession(get, session))
|
|
116
|
+
set(websocketReconnectingAtom, false);
|
|
117
|
+
});
|
|
63
118
|
}
|
|
64
119
|
class ReconnectingWebsocket {
|
|
65
120
|
constructor(url) {
|
|
121
|
+
this.session = null;
|
|
66
122
|
this.userCalledClose = false;
|
|
67
123
|
this.reconnectAttempts = 0;
|
|
68
124
|
this.url = url;
|
|
@@ -71,6 +127,12 @@ class ReconnectingWebsocket {
|
|
|
71
127
|
close() {
|
|
72
128
|
this.userCalledClose = true;
|
|
73
129
|
this.ws?.close();
|
|
130
|
+
this.endSession(false);
|
|
131
|
+
}
|
|
132
|
+
endSession(reconnecting) {
|
|
133
|
+
const session = this.session;
|
|
134
|
+
this.session = null;
|
|
135
|
+
this.handleClose?.(session, reconnecting);
|
|
74
136
|
}
|
|
75
137
|
connect() {
|
|
76
138
|
if (this.userCalledClose)
|
|
@@ -83,7 +145,7 @@ class ReconnectingWebsocket {
|
|
|
83
145
|
localWs.addEventListener("open", () => {
|
|
84
146
|
clearTimeout(connectTimeout);
|
|
85
147
|
this.reconnectAttempts = 0;
|
|
86
|
-
this.handleOpen?.();
|
|
148
|
+
this.session = this.handleOpen?.() ?? null;
|
|
87
149
|
});
|
|
88
150
|
localWs.addEventListener("close", () => {
|
|
89
151
|
clearTimeout(connectTimeout);
|
|
@@ -91,7 +153,7 @@ class ReconnectingWebsocket {
|
|
|
91
153
|
if (this.userCalledClose) {
|
|
92
154
|
return;
|
|
93
155
|
}
|
|
94
|
-
this.
|
|
156
|
+
this.endSession(true);
|
|
95
157
|
const delay = Math.min(1000 * Math.pow(1.5, this.reconnectAttempts), 30000);
|
|
96
158
|
setTimeout(() => {
|
|
97
159
|
this.reconnectAttempts++;
|
|
@@ -99,7 +161,7 @@ class ReconnectingWebsocket {
|
|
|
99
161
|
}, delay);
|
|
100
162
|
});
|
|
101
163
|
localWs.addEventListener("message", (evt) => {
|
|
102
|
-
this.handleMessage?.(evt);
|
|
164
|
+
this.handleMessage?.(evt, this.session);
|
|
103
165
|
});
|
|
104
166
|
// Browsers expose websocket failures as opaque events with no useful detail.
|
|
105
167
|
// Reconnect handling is driven by close/open, so avoid polluting stderr by
|
|
@@ -107,25 +169,51 @@ class ReconnectingWebsocket {
|
|
|
107
169
|
}
|
|
108
170
|
}
|
|
109
171
|
const onOpenAtom = atom(null, (get, set) => {
|
|
110
|
-
const
|
|
111
|
-
|
|
172
|
+
const session = get(websocketSessionAtom).id + 1;
|
|
173
|
+
set(websocketSessionAtom, { id: session, statusFromSocket: false });
|
|
112
174
|
set(websocketReconnectingAtom, true);
|
|
175
|
+
set(currentStatusIsLiveRW, false);
|
|
113
176
|
set(errorLoadingLast30RW, null);
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
177
|
+
set(errorLoadingLogRW, null);
|
|
178
|
+
set(bufferedLogAtom, OrderedMap.empty());
|
|
179
|
+
loadConnection(get, set, session);
|
|
180
|
+
return session;
|
|
181
|
+
});
|
|
182
|
+
// Every close, including disposal, ends the socket's own session; only an unexpected close
|
|
183
|
+
// reconnects. A connection cannot end a newer connection's session.
|
|
184
|
+
const onCloseAtom = atom(null, (get, set, session, reconnecting) => {
|
|
185
|
+
if (reconnecting)
|
|
186
|
+
set(websocketReconnectingAtom, true);
|
|
187
|
+
if (session === null || !isCurrentSession(get, session))
|
|
188
|
+
return;
|
|
189
|
+
set(websocketSessionAtom, { id: session + 1, statusFromSocket: false });
|
|
190
|
+
set(currentStatusIsLiveRW, false);
|
|
191
|
+
set(bufferedLogAtom, null);
|
|
120
192
|
});
|
|
121
|
-
const onMessageAtom = atom(null, (
|
|
193
|
+
const onMessageAtom = atom(null, (get, set, evt, session) => {
|
|
194
|
+
if (session === null || !isCurrentSession(get, session))
|
|
195
|
+
return;
|
|
122
196
|
const serverEvt = ServerEvent.fromJS(JSON.parse(evt.data));
|
|
123
|
-
|
|
197
|
+
const eventAndTime = { evt: serverEvt, now: new Date(), expire: true };
|
|
198
|
+
set(onLiveServerEvent, eventAndTime);
|
|
199
|
+
const log = serverEvt.logEntry;
|
|
200
|
+
const buffered = get(bufferedLogAtom);
|
|
201
|
+
if (!log || !get(loadedLogCountersAtom).has(log.counter)) {
|
|
202
|
+
if (log && buffered !== null) {
|
|
203
|
+
set(bufferedLogAtom, buffered.set(log.counter, log));
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
set(onHistoricalServerEvent, eventAndTime);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (serverEvt.newCurrentStatus) {
|
|
210
|
+
set(websocketSessionAtom, { id: session, statusFromSocket: true });
|
|
211
|
+
set(currentStatusIsLiveRW, true);
|
|
212
|
+
}
|
|
124
213
|
});
|
|
125
214
|
export function WebsocketConnection() {
|
|
126
215
|
const onOpen = useSetAtom(onOpenAtom);
|
|
127
|
-
const
|
|
128
|
-
const onReconnecting = useCallback(() => setReconnecting(true), [setReconnecting]);
|
|
216
|
+
const onClose = useSetAtom(onCloseAtom);
|
|
129
217
|
const onMessage = useSetAtom(onMessageAtom);
|
|
130
218
|
const fmsInfoLoadable = useAtomValue(fmsInformation);
|
|
131
219
|
const websocketRef = useRef(null);
|
|
@@ -151,7 +239,7 @@ export function WebsocketConnection() {
|
|
|
151
239
|
}
|
|
152
240
|
const websocket = new ReconnectingWebsocket(uri);
|
|
153
241
|
websocket.handleOpen = onOpen;
|
|
154
|
-
websocket.
|
|
242
|
+
websocket.handleClose = onClose;
|
|
155
243
|
websocket.handleMessage = onMessage;
|
|
156
244
|
websocketRef.current = websocket;
|
|
157
245
|
return () => {
|
|
@@ -160,6 +248,6 @@ export function WebsocketConnection() {
|
|
|
160
248
|
websocketRef.current = null;
|
|
161
249
|
}
|
|
162
250
|
};
|
|
163
|
-
}, [fmsInfoLoadable, onMessage, onOpen,
|
|
251
|
+
}, [fmsInfoLoadable, onMessage, onOpen, onClose]);
|
|
164
252
|
return null;
|
|
165
253
|
}
|
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
const nr = "-?\\d+(?:[\\.,]\\d+)?";
|
|
2
2
|
const dateRegex = "(" + nr + "Y)?(" + nr + "M)?(" + nr + "D)?";
|
|
3
3
|
const timeRegex = "T(" + nr + "H)?(" + nr + "M)?(" + nr + "S)?";
|
|
4
|
-
const durationRegex = new RegExp("P" + dateRegex + "(?:" + timeRegex + ")
|
|
4
|
+
const durationRegex = new RegExp("^(-?)P" + dateRegex + "(?:" + timeRegex + ")?$");
|
|
5
5
|
export default function parseISODuration(argument) {
|
|
6
6
|
const match = durationRegex.exec(argument);
|
|
7
7
|
if (!match) {
|
|
8
8
|
return null;
|
|
9
9
|
}
|
|
10
10
|
// at least one part must be specified
|
|
11
|
-
if (!match
|
|
11
|
+
if (!match.slice(2).some(Boolean)) {
|
|
12
12
|
return null;
|
|
13
13
|
}
|
|
14
|
+
const sign = match[1] === "-" ? -1 : 1;
|
|
14
15
|
const duration = {};
|
|
15
|
-
if (match[1])
|
|
16
|
-
duration.years = parseFloat(match[1]);
|
|
17
16
|
if (match[2])
|
|
18
|
-
duration.
|
|
17
|
+
duration.years = sign * parseFloat(match[2]);
|
|
19
18
|
if (match[3])
|
|
20
|
-
duration.
|
|
19
|
+
duration.months = sign * parseFloat(match[3]);
|
|
21
20
|
if (match[4])
|
|
22
|
-
duration.
|
|
21
|
+
duration.days = sign * parseFloat(match[4]);
|
|
23
22
|
if (match[5])
|
|
24
|
-
duration.
|
|
23
|
+
duration.hours = sign * parseFloat(match[5]);
|
|
25
24
|
if (match[6])
|
|
26
|
-
duration.
|
|
25
|
+
duration.minutes = sign * parseFloat(match[6]);
|
|
26
|
+
if (match[7])
|
|
27
|
+
duration.seconds = sign * parseFloat(match[7]);
|
|
27
28
|
return duration;
|
|
28
29
|
}
|
|
29
30
|
export function durationToSeconds(duration) {
|
|
@@ -36,10 +36,11 @@ The [operations](client-operations#material) and [quality](client-quality#quaran
|
|
|
36
36
|
webpages allow supervisors, quality engineers and others to manually move material between the
|
|
37
37
|
various quarantined queues, view all the material, add notes, re-introduce material to "active"
|
|
38
38
|
queues, or scrap material. In addition, the [server configuration](server-config) contains a setting
|
|
39
|
-
_QuarantineQueue_ for the initial quarantine queue.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
_QuarantineQueue_ for the initial quarantine queue. Direct quarantine moves material that is waiting
|
|
40
|
+
in a queue into this configured queue. A quarantine signal instead records a request for the backend
|
|
41
|
+
to handle material when it leaves automation control; it does not immediately move material or
|
|
42
|
+
cancel a load. The [operator procedures](operator-procedures#quarantine-material) explain this
|
|
43
|
+
distinction. The available actions depend on the installation and the material's current state.
|
|
43
44
|
|
|
44
45
|
FMS Insight allows arbitrary quarantined material queues, but we suggest you follow a scheme similar
|
|
45
46
|
to the "TODO, In-Progress, Done" Kanban task management/project management technique.
|
package/docs/mazak.md
CHANGED
|
@@ -2,16 +2,14 @@
|
|
|
2
2
|
title: Mazak Palletech Integration
|
|
3
3
|
nav: FMS Insight Server > Mazak
|
|
4
4
|
description: >-
|
|
5
|
-
FMS Insight
|
|
6
|
-
|
|
7
|
-
all the data in the cell controller.
|
|
5
|
+
FMS Insight supports Mazak Palletech Web Version and Smooth/Neo PMC. FMS Insight can read all
|
|
6
|
+
events from the cell controller and can also edit almost all the data in the cell controller.
|
|
8
7
|
---
|
|
9
8
|
|
|
10
9
|
# FMS Insight Mazak Palletech Integration
|
|
11
10
|
|
|
12
|
-
FMS Insight
|
|
13
|
-
|
|
14
|
-
all the data in the cell controller.
|
|
11
|
+
FMS Insight supports Mazak Palletech Web Version and Smooth/Neo PMC. FMS Insight can read all events
|
|
12
|
+
from the cell controller and can also edit almost all the data in the cell controller.
|
|
15
13
|
|
|
16
14
|
## Load station numbering
|
|
17
15
|
|
|
@@ -23,16 +21,15 @@ maintained separately.
|
|
|
23
21
|
|
|
24
22
|
Omitting the list preserves identity numbering. Explicit lists must contain unique positive IDs and
|
|
25
23
|
cover every controller L/U station used. Job routes outside the map are rejected. The old Starting
|
|
26
|
-
Load Station Number setting has been removed and is
|
|
27
|
-
updating configuration.
|
|
24
|
+
Load Station Number setting has been removed and is no longer read; replace it with an explicit list
|
|
25
|
+
when updating configuration.
|
|
28
26
|
|
|
29
27
|
## Open Database Kit
|
|
30
28
|
|
|
31
29
|
To facilitate the communication between FMS Insight and the Mazak cell controller, you must acquire
|
|
32
30
|
a program called "Mazak Open Database Kit". This is a software program developed by Mazak which
|
|
33
31
|
allows safe access to the data inside the cell controller. Please contact your Mazak representative
|
|
34
|
-
and ask to obtain "Open Database Kit" that matches the specific cell controller (
|
|
35
|
-
Smooth PMC).
|
|
32
|
+
and ask to obtain "Open Database Kit" that matches the specific cell controller (Web or Smooth PMC).
|
|
36
33
|
|
|
37
34
|
## Enable Log CSV
|
|
38
35
|
|
|
@@ -49,10 +46,10 @@ specify the same folder in the FMS Insight server configuration file.
|
|
|
49
46
|
|
|
50
47
|
## Load Instructions
|
|
51
48
|
|
|
52
|
-
On
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
On MazakWeb, one parameter must be changed. If you are using Mazak Smooth PMC, this step can be
|
|
50
|
+
skipped! Open the Mazak Palletech software, go to the parameter edit screen, select `X`, and scroll
|
|
51
|
+
to the setting `X-31`. Set the `X-31` setting from 0 to 1. This setting will cause CSV files
|
|
52
|
+
describing the current load and unload operation at the load station to be output to the
|
|
56
53
|
`c:\Mazak\FMS\LDS` directory. FMS Insight monitors this directory and uses the CSV files to display
|
|
57
54
|
the parts being loaded and unloaded from each pallet at the load station.
|
|
58
55
|
|
|
@@ -69,6 +69,12 @@ detailed inspection, or some other rework. Material can be quarantined on the qu
|
|
|
69
69
|
the material dialog and clicking a button. This moves the material to the quarantine queue where it
|
|
70
70
|
is visible on the supervisor's material page.
|
|
71
71
|
|
|
72
|
+
A quarantine signal records a request for the backend to handle material when it leaves automation
|
|
73
|
+
control. The signal does not immediately move material or cancel a load. Direct quarantine moves
|
|
74
|
+
material that is waiting in a queue into the configured quarantine queue. The available actions
|
|
75
|
+
depend on the installation and the material's current state. Follow the displayed instructions and
|
|
76
|
+
the installation's procedure before moving physical material.
|
|
77
|
+
|
|
72
78
|
Once the material is ready to be re-introduced into the cell, the operator should bring it back to
|
|
73
79
|
the shop floor. Once the material has arrived, the operator can click a button on the queues webpage
|
|
74
80
|
(or scan the barcode) to add the material into the queue. Once it is back in the queue, the cell
|
|
@@ -94,6 +100,14 @@ quarantine queue. That material can then be re-introduced back into the queue so
|
|
|
94
100
|
FMS Insight matches the material on the shop floor. In addition, FMS Insight allows the ability to
|
|
95
101
|
invalidate the inadvertent load events that were created.
|
|
96
102
|
|
|
103
|
+
Only the latest still-valid process can be invalidated. For material with recorded processes 1, 2,
|
|
104
|
+
and 3, first invalidate process 3, then review the refreshed history before invalidating process 2
|
|
105
|
+
in a separate action. Continue backwards one process at a time as needed. To change a casting or job
|
|
106
|
+
assignment, first invalidate any later processes in separate actions.
|
|
107
|
+
|
|
108
|
+
Invalidation affects whole recorded cycle events and all material listed in the confirmation. The
|
|
109
|
+
original events remain in the event log but no longer contribute to active material reconstruction.
|
|
110
|
+
|
|
97
111
|
Insight does not reassign recorded pallet manufacturing history from one material identity to
|
|
98
112
|
another. If machining was attributed to the wrong identity, record an explanatory operator note and
|
|
99
113
|
use the installation's traceability exception procedure. Quarantine, invalidation, and readmission
|
package/docs/server-config.md
CHANGED
|
@@ -29,19 +29,27 @@ message with details into the [event log](server-errors).
|
|
|
29
29
|
|
|
30
30
|
FMS Insight uses [SQLite](https://www.sqlite.org/) to store data about the cell. The primary data
|
|
31
31
|
stored is a log of the activity of all parts, pallets, machines, jobs, schedules, inspections,
|
|
32
|
-
serial numbers, orders, and other data.
|
|
33
|
-
|
|
32
|
+
serial numbers, orders, and other data. The databases also hold operational state, including
|
|
33
|
+
committed basket contents, material-allocation identities, and operation receipts used to recognize
|
|
34
|
+
completed work on retries.
|
|
34
35
|
|
|
35
36
|
The SQLite databases are by default stored locally in the Windows Common AppData folder which on a
|
|
36
37
|
default Windows install is `c:\ProgramData\SeedTactics\FMSInsight`. This path can be changed in the
|
|
37
38
|
`config.ini` file if needed, but we suggest that the databases are kept on the local drive for
|
|
38
|
-
performance and data integrity (SQLite works best on a local drive).
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
performance and data integrity (SQLite works best on a local drive). Database size grows with
|
|
40
|
+
production activity and retained history; allow space for both production databases and backups.
|
|
41
|
+
|
|
42
|
+
Preserve production databases and back them up before upgrades. Use a backup method that captures a
|
|
43
|
+
consistent SQLite database, such as stopping the server before copying its database files. If an
|
|
44
|
+
integration maintains additional coordination databases, follow its procedure for backing up the
|
|
45
|
+
complete installation consistently.
|
|
46
|
+
|
|
47
|
+
Deleting a production database loses both history and operational identities and retry records.
|
|
48
|
+
Creating a fresh database does not reconstruct that state from the equipment. Follow the
|
|
49
|
+
integration's recovery procedure before resetting or restoring databases, including reconciling the
|
|
50
|
+
physical cell and any integration-specific state. A backup from an earlier point in production is
|
|
51
|
+
not automatically safe to restore against a cell that has continued operating.
|
|
52
|
+
|
|
53
|
+
Fresh databases can be used for controlled QA or initial commissioning when the physical cell and
|
|
54
|
+
the integration's state have been prepared for a fresh start. FMS Insight creates missing databases
|
|
55
|
+
at startup; integrations may impose additional startup and initialization requirements.
|