@seedtactics/insight-client 16.4.0
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 +37 -0
- package/dist/cell-status/buffers.d.ts +36 -0
- package/dist/cell-status/buffers.js +127 -0
- package/dist/cell-status/current-status.d.ts +30 -0
- package/dist/cell-status/current-status.js +200 -0
- package/dist/cell-status/estimated-cycle-times.d.ts +41 -0
- package/dist/cell-status/estimated-cycle-times.js +257 -0
- package/dist/cell-status/inspections.d.ts +55 -0
- package/dist/cell-status/inspections.js +213 -0
- package/dist/cell-status/loading.d.ts +26 -0
- package/dist/cell-status/loading.js +112 -0
- package/dist/cell-status/material-details.d.ts +116 -0
- package/dist/cell-status/material-details.js +422 -0
- package/dist/cell-status/material-summary.d.ts +52 -0
- package/dist/cell-status/material-summary.js +312 -0
- package/dist/cell-status/names.d.ts +19 -0
- package/dist/cell-status/names.js +134 -0
- package/dist/cell-status/pallet-cycles.d.ts +24 -0
- package/dist/cell-status/pallet-cycles.js +78 -0
- package/dist/cell-status/rebookings.d.ts +30 -0
- package/dist/cell-status/rebookings.js +139 -0
- package/dist/cell-status/scheduled-jobs.d.ts +18 -0
- package/dist/cell-status/scheduled-jobs.js +94 -0
- package/dist/cell-status/sim-day-usage.d.ts +14 -0
- package/dist/cell-status/sim-day-usage.js +54 -0
- package/dist/cell-status/sim-production.d.ts +22 -0
- package/dist/cell-status/sim-production.js +91 -0
- package/dist/cell-status/sim-station-use.d.ts +25 -0
- package/dist/cell-status/sim-station-use.js +71 -0
- package/dist/cell-status/station-cycles.d.ts +34 -0
- package/dist/cell-status/station-cycles.js +145 -0
- package/dist/cell-status/tool-replacements.d.ts +44 -0
- package/dist/cell-status/tool-replacements.js +155 -0
- package/dist/cell-status/tool-usage.d.ts +25 -0
- package/dist/cell-status/tool-usage.js +95 -0
- package/dist/components/App.d.ts +15 -0
- package/dist/components/App.js +549 -0
- package/dist/components/AxisAndGrid.d.ts +51 -0
- package/dist/components/AxisAndGrid.js +47 -0
- package/dist/components/BarcodeScanning.d.ts +6 -0
- package/dist/components/BarcodeScanning.js +150 -0
- package/dist/components/ChartTooltip.d.ts +28 -0
- package/dist/components/ChartTooltip.js +95 -0
- package/dist/components/ChooseMode.d.ts +18 -0
- package/dist/components/ChooseMode.js +136 -0
- package/dist/components/ChooseOperator.d.ts +1 -0
- package/dist/components/ChooseOperator.js +93 -0
- package/dist/components/ErrorsAndLoading.d.ts +9 -0
- package/dist/components/ErrorsAndLoading.js +55 -0
- package/dist/components/LoadingIcon.d.ts +1 -0
- package/dist/components/LoadingIcon.js +48 -0
- package/dist/components/LogEntry.d.ts +16 -0
- package/dist/components/LogEntry.js +365 -0
- package/dist/components/ManualSerialEntry.d.ts +5 -0
- package/dist/components/ManualSerialEntry.js +91 -0
- package/dist/components/MonthSelect.d.ts +6 -0
- package/dist/components/MonthSelect.js +67 -0
- package/dist/components/Navigation.d.ts +23 -0
- package/dist/components/Navigation.js +120 -0
- package/dist/components/VerboseLogging.d.ts +1 -0
- package/dist/components/VerboseLogging.js +47 -0
- package/dist/components/analysis/AnalysisSelectToolbar.d.ts +1 -0
- package/dist/components/analysis/AnalysisSelectToolbar.js +55 -0
- package/dist/components/analysis/BufferChart.d.ts +1 -0
- package/dist/components/analysis/BufferChart.js +139 -0
- package/dist/components/analysis/CostPerPiece.d.ts +2 -0
- package/dist/components/analysis/CostPerPiece.js +175 -0
- package/dist/components/analysis/CycleChart.d.ts +42 -0
- package/dist/components/analysis/CycleChart.js +281 -0
- package/dist/components/analysis/DataTable.d.ts +83 -0
- package/dist/components/analysis/DataTable.js +215 -0
- package/dist/components/analysis/EfficiencyPage.d.ts +2 -0
- package/dist/components/analysis/EfficiencyPage.js +138 -0
- package/dist/components/analysis/HeatChart.d.ts +22 -0
- package/dist/components/analysis/HeatChart.js +161 -0
- package/dist/components/analysis/InspectionDataTable.d.ts +10 -0
- package/dist/components/analysis/InspectionDataTable.js +148 -0
- package/dist/components/analysis/InspectionSankey.d.ts +12 -0
- package/dist/components/analysis/InspectionSankey.js +140 -0
- package/dist/components/analysis/PalletCycleCards.d.ts +1 -0
- package/dist/components/analysis/PalletCycleCards.js +137 -0
- package/dist/components/analysis/PartCycleCards.d.ts +2 -0
- package/dist/components/analysis/PartCycleCards.js +331 -0
- package/dist/components/analysis/QualityPage.d.ts +1 -0
- package/dist/components/analysis/QualityPage.js +49 -0
- package/dist/components/analysis/ScheduleHistory.d.ts +3 -0
- package/dist/components/analysis/ScheduleHistory.js +108 -0
- package/dist/components/analysis/StationDataTable.d.ts +25 -0
- package/dist/components/analysis/StationDataTable.js +246 -0
- package/dist/components/analysis/ToolReplacements.d.ts +1 -0
- package/dist/components/analysis/ToolReplacements.js +370 -0
- package/dist/components/operations/AllMaterial.d.ts +5 -0
- package/dist/components/operations/AllMaterial.js +267 -0
- package/dist/components/operations/ChartRangeEdit.d.ts +4 -0
- package/dist/components/operations/ChartRangeEdit.js +148 -0
- package/dist/components/operations/CloseoutReport.d.ts +2 -0
- package/dist/components/operations/CloseoutReport.js +172 -0
- package/dist/components/operations/CompletedParts.d.ts +2 -0
- package/dist/components/operations/CompletedParts.js +286 -0
- package/dist/components/operations/CurrentWorkorders.d.ts +3 -0
- package/dist/components/operations/CurrentWorkorders.js +368 -0
- package/dist/components/operations/Dashboard.d.ts +2 -0
- package/dist/components/operations/Dashboard.js +90 -0
- package/dist/components/operations/OEEChart.d.ts +10 -0
- package/dist/components/operations/OEEChart.js +173 -0
- package/dist/components/operations/Outliers.d.ts +4 -0
- package/dist/components/operations/Outliers.js +69 -0
- package/dist/components/operations/ProgramHighlight.d.ts +1 -0
- package/dist/components/operations/ProgramHighlight.js +9 -0
- package/dist/components/operations/Programs.d.ts +5 -0
- package/dist/components/operations/Programs.js +363 -0
- package/dist/components/operations/Rebookings.d.ts +1 -0
- package/dist/components/operations/Rebookings.js +213 -0
- package/dist/components/operations/RecentCycleChart.d.ts +4 -0
- package/dist/components/operations/RecentCycleChart.js +240 -0
- package/dist/components/operations/RecentProduction.d.ts +2 -0
- package/dist/components/operations/RecentProduction.js +213 -0
- package/dist/components/operations/RecentSchedules.d.ts +12 -0
- package/dist/components/operations/RecentSchedules.js +180 -0
- package/dist/components/operations/RecentStationCycles.d.ts +4 -0
- package/dist/components/operations/RecentStationCycles.js +159 -0
- package/dist/components/operations/ShiftSettings.d.ts +6 -0
- package/dist/components/operations/ShiftSettings.js +134 -0
- package/dist/components/operations/SimDayUsage.d.ts +1 -0
- package/dist/components/operations/SimDayUsage.js +133 -0
- package/dist/components/operations/ToolReport.d.ts +3 -0
- package/dist/components/operations/ToolReport.js +233 -0
- package/dist/components/operations/WorkorderGantt.d.ts +1 -0
- package/dist/components/operations/WorkorderGantt.js +124 -0
- package/dist/components/quality/QualityMaterial.d.ts +2 -0
- package/dist/components/quality/QualityMaterial.js +169 -0
- package/dist/components/quality/QualityPaths.d.ts +1 -0
- package/dist/components/quality/QualityPaths.js +53 -0
- package/dist/components/quality/RecentFailedInspections.d.ts +1 -0
- package/dist/components/quality/RecentFailedInspections.js +123 -0
- package/dist/components/routes.d.ts +170 -0
- package/dist/components/routes.js +301 -0
- package/dist/components/station-monitor/BulkRawMaterial.d.ts +11 -0
- package/dist/components/station-monitor/BulkRawMaterial.js +251 -0
- package/dist/components/station-monitor/Closeout.d.ts +5 -0
- package/dist/components/station-monitor/Closeout.js +162 -0
- package/dist/components/station-monitor/CustomStationMonitorDialog.d.ts +1 -0
- package/dist/components/station-monitor/CustomStationMonitorDialog.js +55 -0
- package/dist/components/station-monitor/Inspection.d.ts +8 -0
- package/dist/components/station-monitor/Inspection.js +164 -0
- package/dist/components/station-monitor/InvalidateCycle.d.ts +33 -0
- package/dist/components/station-monitor/InvalidateCycle.js +262 -0
- package/dist/components/station-monitor/JobDetails.d.ts +7 -0
- package/dist/components/station-monitor/JobDetails.js +108 -0
- package/dist/components/station-monitor/LoadStation.d.ts +10 -0
- package/dist/components/station-monitor/LoadStation.js +450 -0
- package/dist/components/station-monitor/Material.d.ts +77 -0
- package/dist/components/station-monitor/Material.js +489 -0
- package/dist/components/station-monitor/MoveMaterialArrows.d.ts +11 -0
- package/dist/components/station-monitor/MoveMaterialArrows.js +118 -0
- package/dist/components/station-monitor/PrintedLabel.d.ts +29 -0
- package/dist/components/station-monitor/PrintedLabel.js +166 -0
- package/dist/components/station-monitor/QuarantineButton.d.ts +4 -0
- package/dist/components/station-monitor/QuarantineButton.js +184 -0
- package/dist/components/station-monitor/Queues.d.ts +23 -0
- package/dist/components/station-monitor/Queues.js +312 -0
- package/dist/components/station-monitor/QueuesAddMaterial.d.ts +30 -0
- package/dist/components/station-monitor/QueuesAddMaterial.js +248 -0
- package/dist/components/station-monitor/SelectInspType.d.ts +2 -0
- package/dist/components/station-monitor/SelectInspType.js +99 -0
- package/dist/components/station-monitor/SelectWorkorder.d.ts +4 -0
- package/dist/components/station-monitor/SelectWorkorder.js +100 -0
- package/dist/components/station-monitor/StationToolbar.d.ts +3 -0
- package/dist/components/station-monitor/StationToolbar.js +168 -0
- package/dist/components/station-monitor/SystemOverview.d.ts +46 -0
- package/dist/components/station-monitor/SystemOverview.js +439 -0
- package/dist/components/station-monitor/Whiteboard.d.ts +10 -0
- package/dist/components/station-monitor/Whiteboard.js +67 -0
- package/dist/data/all-material-bins.d.ts +45 -0
- package/dist/data/all-material-bins.js +224 -0
- package/dist/data/chart-times.d.ts +20 -0
- package/dist/data/chart-times.js +99 -0
- package/dist/data/cost-per-piece.d.ts +32 -0
- package/dist/data/cost-per-piece.js +183 -0
- package/dist/data/current-cycles.d.ts +13 -0
- package/dist/data/current-cycles.js +144 -0
- package/dist/data/inspection-sankey.d.ts +15 -0
- package/dist/data/inspection-sankey.js +147 -0
- package/dist/data/move-arrows.d.ts +48 -0
- package/dist/data/move-arrows.js +217 -0
- package/dist/data/operators.d.ts +2 -0
- package/dist/data/operators.js +44 -0
- package/dist/data/part-summary.d.ts +17 -0
- package/dist/data/part-summary.js +107 -0
- package/dist/data/path-lookup.d.ts +13 -0
- package/dist/data/path-lookup.js +107 -0
- package/dist/data/queue-material.d.ts +46 -0
- package/dist/data/queue-material.js +256 -0
- package/dist/data/results.bufferchart.d.ts +10 -0
- package/dist/data/results.bufferchart.js +90 -0
- package/dist/data/results.completed-parts.d.ts +26 -0
- package/dist/data/results.completed-parts.js +181 -0
- package/dist/data/results.cycles.d.ts +86 -0
- package/dist/data/results.cycles.js +454 -0
- package/dist/data/results.inspection.d.ts +36 -0
- package/dist/data/results.inspection.js +188 -0
- package/dist/data/results.oee.d.ts +40 -0
- package/dist/data/results.oee.js +330 -0
- package/dist/data/results.schedules.d.ts +23 -0
- package/dist/data/results.schedules.js +157 -0
- package/dist/data/tools-programs.d.ts +78 -0
- package/dist/data/tools-programs.js +376 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +60 -0
- package/dist/network/api.d.ts +1390 -0
- package/dist/network/api.js +4971 -0
- package/dist/network/backend-mock.d.ts +11 -0
- package/dist/network/backend-mock.js +512 -0
- package/dist/network/backend.d.ts +57 -0
- package/dist/network/backend.js +77 -0
- package/dist/network/load-specific-month.d.ts +13 -0
- package/dist/network/load-specific-month.js +77 -0
- package/dist/network/server-settings.d.ts +12 -0
- package/dist/network/server-settings.js +92 -0
- package/dist/network/websocket.d.ts +4 -0
- package/dist/network/websocket.js +165 -0
- package/dist/renderer.d.ts +8 -0
- package/dist/renderer.js +55 -0
- package/dist/seedtactics-logo.d.ts +2 -0
- package/dist/seedtactics-logo.js +4 -0
- package/dist/util/chart-colors.d.ts +1 -0
- package/dist/util/chart-colors.js +116 -0
- package/dist/util/chart-helpers.d.ts +3 -0
- package/dist/util/chart-helpers.js +51 -0
- package/dist/util/parseISODuration.d.ts +4 -0
- package/dist/util/parseISODuration.js +40 -0
- package/docs/client-efficiency.md +355 -0
- package/docs/client-engineering.md +54 -0
- package/docs/client-launch.md +55 -0
- package/docs/client-operations.md +88 -0
- package/docs/client-quality.md +74 -0
- package/docs/client-sales.md +61 -0
- package/docs/client-scanners.md +41 -0
- package/docs/client-station-monitor.md +149 -0
- package/docs/client-tools-programs.md +74 -0
- package/docs/improve-fms.md +141 -0
- package/docs/makino.md +40 -0
- package/docs/material-quarantine.md +82 -0
- package/docs/material-tracking.md +236 -0
- package/docs/mazak.md +115 -0
- package/docs/niigata.md +228 -0
- package/docs/operator-procedures.md +106 -0
- package/docs/part-instructions.md +63 -0
- package/docs/screenshots/insight-all-material.png +0 -0
- package/docs/screenshots/insight-analysis-pallets.png +0 -0
- package/docs/screenshots/insight-analysis-part-completed.png +0 -0
- package/docs/screenshots/insight-analysis-sankey.png +0 -0
- package/docs/screenshots/insight-analysis-station-oee.png +0 -0
- package/docs/screenshots/insight-buffer-occupancy.png +0 -0
- package/docs/screenshots/insight-choose-analysis-month.png +0 -0
- package/docs/screenshots/insight-closeout.png +0 -0
- package/docs/screenshots/insight-cost-percentages.png +0 -0
- package/docs/screenshots/insight-dashboard.png +0 -0
- package/docs/screenshots/insight-event-custom-view.jpg +0 -0
- package/docs/screenshots/insight-event-viewer.jpg +0 -0
- package/docs/screenshots/insight-inspection.png +0 -0
- package/docs/screenshots/insight-load-station-details.png +0 -0
- package/docs/screenshots/insight-load-station.png +0 -0
- package/docs/screenshots/insight-loadcycle-graph.png +0 -0
- package/docs/screenshots/insight-loadstation-small.jpg +0 -0
- package/docs/screenshots/insight-machinecycle-graph.png +0 -0
- package/docs/screenshots/insight-machinecycle-table.png +0 -0
- package/docs/screenshots/insight-machinecycles.png +0 -0
- package/docs/screenshots/insight-machinehours.png +0 -0
- package/docs/screenshots/insight-machineoutliers.png +0 -0
- package/docs/screenshots/insight-monthly-schedules.png +0 -0
- package/docs/screenshots/insight-operations-material.png +0 -0
- package/docs/screenshots/insight-operations-overview.png +0 -0
- package/docs/screenshots/insight-operations-reports.png +0 -0
- package/docs/screenshots/insight-part-cost.png +0 -0
- package/docs/screenshots/insight-program-report.png +0 -0
- package/docs/screenshots/insight-quality-material-details.png +0 -0
- package/docs/screenshots/insight-quality-material.png +0 -0
- package/docs/screenshots/insight-quality-quarantine.png +0 -0
- package/docs/screenshots/insight-quality-sankey.png +0 -0
- package/docs/screenshots/insight-quality-similar-paths.png +0 -0
- package/docs/screenshots/insight-queue-details.png +0 -0
- package/docs/screenshots/insight-queues-jobs-table.png +0 -0
- package/docs/screenshots/insight-queues.png +0 -0
- package/docs/screenshots/insight-sim-day-usage.png +0 -0
- package/docs/screenshots/insight-station-system-overview-buttons.png +0 -0
- package/docs/screenshots/insight-station-system-overview.png +0 -0
- package/docs/screenshots/insight-system-overview.png +0 -0
- package/docs/screenshots/insight-tool-replacements.png +0 -0
- package/docs/screenshots/insight-tool-report.png +0 -0
- package/docs/screenshots/insight-toolbar-btns.png +0 -0
- package/docs/screenshots/insight-workorder-gantt.png +0 -0
- package/docs/screenshots/insight-workorders.png +0 -0
- package/docs/security.md +131 -0
- package/docs/server-config.md +56 -0
- package/docs/server-errors.md +44 -0
- package/package.json +90 -0
- package/src/index.ts +65 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type MockEvents = ReadonlyArray<object>;
|
|
2
|
+
export interface MockData {
|
|
3
|
+
readonly curSt: object;
|
|
4
|
+
readonly jobs: ReadonlyArray<object>;
|
|
5
|
+
readonly tools: ReadonlyArray<object>;
|
|
6
|
+
readonly programs: ReadonlyArray<object>;
|
|
7
|
+
readonly toolUse: {
|
|
8
|
+
[evtCounter: string]: object;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare function registerMockBackend(offsetSeconds: number, mockD: Promise<MockData>, mockEvts: Promise<MockEvents>): void;
|
|
@@ -0,0 +1,512 @@
|
|
|
1
|
+
/* Copyright (c) 2021, John Lenz
|
|
2
|
+
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
* Redistributions of source code must retain the above copyright
|
|
9
|
+
notice, this list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
* Redistributions in binary form must reproduce the above
|
|
12
|
+
copyright notice, this list of conditions and the following
|
|
13
|
+
disclaimer in the documentation and/or other materials provided
|
|
14
|
+
with the distribution.
|
|
15
|
+
|
|
16
|
+
* Neither the name of John Lenz, Black Maple Software, SeedTactics,
|
|
17
|
+
nor the names of other contributors may be used to endorse or
|
|
18
|
+
promote products derived from this software without specific
|
|
19
|
+
prior written permission.
|
|
20
|
+
|
|
21
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
22
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
23
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
24
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
25
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
26
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
27
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
28
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
29
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
30
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
31
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
32
|
+
*/
|
|
33
|
+
import { addSeconds } from "date-fns";
|
|
34
|
+
import * as api from "./api.js";
|
|
35
|
+
import { registerBackend } from "./backend.js";
|
|
36
|
+
import { LazySeq, mkCompareByProperties } from "@seedtactics/immutable-collections";
|
|
37
|
+
function offsetJob(j, offsetSeconds) {
|
|
38
|
+
j.routeStartUTC = addSeconds(j.routeStartUTC, offsetSeconds);
|
|
39
|
+
j.routeEndUTC = addSeconds(j.routeEndUTC, offsetSeconds);
|
|
40
|
+
for (const proc of j.procsAndPaths) {
|
|
41
|
+
for (const path of proc.paths) {
|
|
42
|
+
path.simulatedStartingUTC = addSeconds(path.simulatedStartingUTC, offsetSeconds);
|
|
43
|
+
for (const prod of path.simulatedProduction || []) {
|
|
44
|
+
prod.timeUTC = addSeconds(prod.timeUTC, offsetSeconds);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function transformTime(offsetSeconds, mockD) {
|
|
50
|
+
const status = api.CurrentStatus.fromJS(mockD.curSt);
|
|
51
|
+
status.timeOfCurrentStatusUTC = addSeconds(status.timeOfCurrentStatusUTC, offsetSeconds);
|
|
52
|
+
for (const j of Object.values(status.jobs)) {
|
|
53
|
+
offsetJob(j, offsetSeconds);
|
|
54
|
+
}
|
|
55
|
+
for (const m of status.material) {
|
|
56
|
+
if (m.location.face && typeof m.location.face === "string") {
|
|
57
|
+
m.location.face = parseInt(m.location.face, 10);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
for (const w of status.workorders ?? []) {
|
|
61
|
+
w.dueDate = addSeconds(w.dueDate, offsetSeconds);
|
|
62
|
+
for (const c of w.comments ?? []) {
|
|
63
|
+
c.timeUTC = addSeconds(c.timeUTC, offsetSeconds);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const allNewJobs = mockD.jobs.map(api.NewJobs.fromJS);
|
|
67
|
+
const historicJobs = {};
|
|
68
|
+
for (const newJ of allNewJobs) {
|
|
69
|
+
for (const j of newJ.jobs) {
|
|
70
|
+
offsetJob(j, offsetSeconds);
|
|
71
|
+
historicJobs[j.unique] = new api.HistoricJob({
|
|
72
|
+
...j,
|
|
73
|
+
copiedToSystem: false,
|
|
74
|
+
scheduleId: newJ.scheduleId,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
for (const s of newJ.stationUse || []) {
|
|
78
|
+
s.startUTC = addSeconds(s.startUTC, offsetSeconds);
|
|
79
|
+
s.endUTC = addSeconds(s.endUTC, offsetSeconds);
|
|
80
|
+
}
|
|
81
|
+
for (const w of newJ.currentUnfilledWorkorders || []) {
|
|
82
|
+
w.dueDate = addSeconds(w.dueDate, offsetSeconds);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const historic = {
|
|
86
|
+
jobs: historicJobs,
|
|
87
|
+
stationUse: LazySeq.of(allNewJobs)
|
|
88
|
+
.flatMap((j) => j.stationUse || [])
|
|
89
|
+
.toMutableArray(),
|
|
90
|
+
};
|
|
91
|
+
return {
|
|
92
|
+
curSt: status,
|
|
93
|
+
jobs: historic,
|
|
94
|
+
workorders: new Map(),
|
|
95
|
+
tools: mockD.tools.map(api.ToolInMachine.fromJS),
|
|
96
|
+
programs: mockD.programs.map(api.ProgramInCellController.fromJS),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
async function loadEventsJson(offsetSeconds, mockD, evts) {
|
|
100
|
+
const toolUse = (await mockD).toolUse;
|
|
101
|
+
return LazySeq.of(await evts)
|
|
102
|
+
.map((evtJson) => {
|
|
103
|
+
const tools = toolUse[evtJson.counter.toString()];
|
|
104
|
+
// the type of pal switched from string to int and I didn't want
|
|
105
|
+
// to regenerate all the data
|
|
106
|
+
if ("pal" in evtJson && typeof evtJson.pal === "string") {
|
|
107
|
+
evtJson.pal = parseInt(evtJson.pal);
|
|
108
|
+
}
|
|
109
|
+
const e = api.LogEntry.fromJS(tools ? { ...evtJson, tooluse: tools } : evtJson);
|
|
110
|
+
e.endUTC = addSeconds(e.endUTC, offsetSeconds);
|
|
111
|
+
return e;
|
|
112
|
+
})
|
|
113
|
+
.filter((e) => {
|
|
114
|
+
if (e.type === api.LogType.InspectionResult) {
|
|
115
|
+
// filter out a couple inspection results so they are uninspected
|
|
116
|
+
// and display as uninspected on the station monitor screen
|
|
117
|
+
const mid = e.material[0].id;
|
|
118
|
+
if (mid === 2993 || mid === 2974) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
.toMutableArray()
|
|
130
|
+
.sort(mkCompareByProperties((e) => e.endUTC.getTime(), (e) => e.counter));
|
|
131
|
+
}
|
|
132
|
+
function findMatById(evts, matId) {
|
|
133
|
+
return LazySeq.of(evts)
|
|
134
|
+
.flatMap((e) => e.material)
|
|
135
|
+
.find((m) => m.id === matId);
|
|
136
|
+
}
|
|
137
|
+
export function registerMockBackend(offsetSeconds, mockD, mockEvts) {
|
|
138
|
+
const data = mockD.then((d) => transformTime(offsetSeconds, d));
|
|
139
|
+
const events = loadEventsJson(offsetSeconds, mockD, mockEvts);
|
|
140
|
+
const fmsB = {
|
|
141
|
+
fMSInformation() {
|
|
142
|
+
return Promise.resolve({
|
|
143
|
+
name: "mock",
|
|
144
|
+
version: "1.0.0",
|
|
145
|
+
requireScanAtCloseout: false,
|
|
146
|
+
requireWorkorderBeforeAllowCloseoutComplete: false,
|
|
147
|
+
additionalLogServers: [],
|
|
148
|
+
usingLabelPrinterForSerials: false,
|
|
149
|
+
});
|
|
150
|
+
},
|
|
151
|
+
printLabel() {
|
|
152
|
+
return Promise.resolve();
|
|
153
|
+
},
|
|
154
|
+
async parseBarcode(barcode) {
|
|
155
|
+
barcode ??= "";
|
|
156
|
+
const commaIdx = barcode.indexOf(",");
|
|
157
|
+
if (commaIdx >= 0) {
|
|
158
|
+
barcode = barcode.substring(0, commaIdx);
|
|
159
|
+
}
|
|
160
|
+
barcode = barcode.replace(/[^0-9a-zA-Z-_]/g, "");
|
|
161
|
+
const mat = await serialsToMatId.then((s) => s.get(barcode ?? ""));
|
|
162
|
+
if (mat) {
|
|
163
|
+
return {
|
|
164
|
+
existingMaterial: new api.MaterialDetails({
|
|
165
|
+
materialID: mat.matId,
|
|
166
|
+
partName: mat.part,
|
|
167
|
+
jobUnique: mat.uniq,
|
|
168
|
+
numProcesses: mat.numProc,
|
|
169
|
+
serial: barcode,
|
|
170
|
+
}),
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
return {
|
|
175
|
+
potentialNewMaterial: new api.ScannedPotentialNewMaterial({
|
|
176
|
+
serial: barcode,
|
|
177
|
+
}),
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
enableVerboseLoggingForFiveMinutes() {
|
|
182
|
+
return Promise.resolve();
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
const jobsB = {
|
|
186
|
+
history(_startUTC, _endUTC) {
|
|
187
|
+
return data.then((d) => d.jobs);
|
|
188
|
+
},
|
|
189
|
+
recent(_startUTC, _alreadyKnownSchIds) {
|
|
190
|
+
return data.then((d) => d.jobs);
|
|
191
|
+
},
|
|
192
|
+
currentStatus() {
|
|
193
|
+
return data.then((d) => d.curSt);
|
|
194
|
+
},
|
|
195
|
+
setJobComment(_uniq, _comment) {
|
|
196
|
+
// do nothing
|
|
197
|
+
return Promise.resolve();
|
|
198
|
+
},
|
|
199
|
+
removeMaterialFromAllQueues(_materialId, _operName) {
|
|
200
|
+
// do nothing
|
|
201
|
+
return Promise.resolve();
|
|
202
|
+
},
|
|
203
|
+
bulkRemoveMaterialFromQueues() {
|
|
204
|
+
// do nothing
|
|
205
|
+
return Promise.resolve();
|
|
206
|
+
},
|
|
207
|
+
setMaterialInQueue() {
|
|
208
|
+
// do nothing
|
|
209
|
+
return Promise.resolve();
|
|
210
|
+
},
|
|
211
|
+
addUnprocessedMaterialToQueue() {
|
|
212
|
+
// do nothing
|
|
213
|
+
return Promise.resolve(undefined);
|
|
214
|
+
},
|
|
215
|
+
addUnallocatedCastingToQueue() {
|
|
216
|
+
// do nothing
|
|
217
|
+
return Promise.resolve([]);
|
|
218
|
+
},
|
|
219
|
+
signalMaterialForQuarantine() {
|
|
220
|
+
return Promise.resolve();
|
|
221
|
+
},
|
|
222
|
+
swapMaterialOnPallet() {
|
|
223
|
+
return Promise.resolve();
|
|
224
|
+
},
|
|
225
|
+
invalidatePalletCycle() {
|
|
226
|
+
return Promise.resolve(null);
|
|
227
|
+
},
|
|
228
|
+
unscheduledRebookings() {
|
|
229
|
+
return Promise.resolve([]);
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
const serialsToMatId = data.then(() => events.then((evts) => LazySeq.of(evts)
|
|
233
|
+
.filter((e) => e.type === api.LogType.PartMark)
|
|
234
|
+
.flatMap((e) => e.material.map((m) => [e.result, { matId: m.id, part: m.part, uniq: m.uniq, numProc: m.numproc }]))
|
|
235
|
+
.toRMap((x) => x, (id1, id2) => id2)));
|
|
236
|
+
const logB = {
|
|
237
|
+
get(startUTC, endUTC) {
|
|
238
|
+
return data.then(() => events.then((evts) => evts.filter((e) => e.endUTC >= startUTC && e.endUTC <= endUTC)));
|
|
239
|
+
},
|
|
240
|
+
recent(_lastSeenCounter) {
|
|
241
|
+
// no recent events, everything is static
|
|
242
|
+
return Promise.resolve([]);
|
|
243
|
+
},
|
|
244
|
+
logForMaterial(materialID) {
|
|
245
|
+
return data.then(() => events.then((evts) => evts.filter((e) => LazySeq.of(e.material).some((m) => m.id === materialID))));
|
|
246
|
+
},
|
|
247
|
+
logForMaterials(materialIDs) {
|
|
248
|
+
const matIds = new Set(materialIDs);
|
|
249
|
+
return data.then(() => events.then((evts) => evts.filter((e) => LazySeq.of(e.material).some((m) => matIds.has(m.id)))));
|
|
250
|
+
},
|
|
251
|
+
logForSerial(serial) {
|
|
252
|
+
return serialsToMatId.then((s) => {
|
|
253
|
+
const mId = s.get(serial);
|
|
254
|
+
if (mId !== undefined) {
|
|
255
|
+
return this.logForMaterial(mId.matId);
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
return Promise.resolve([]);
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
},
|
|
262
|
+
async materialForSerial(serial) {
|
|
263
|
+
if (!serial || serial === "")
|
|
264
|
+
return [];
|
|
265
|
+
const mat = await serialsToMatId.then((s) => s.get(serial));
|
|
266
|
+
if (mat === undefined)
|
|
267
|
+
return [];
|
|
268
|
+
return [
|
|
269
|
+
{
|
|
270
|
+
materialID: mat.matId,
|
|
271
|
+
jobUnique: mat.uniq,
|
|
272
|
+
partName: mat.part,
|
|
273
|
+
numProcesses: mat.numProc,
|
|
274
|
+
workorder: undefined,
|
|
275
|
+
serial: serial,
|
|
276
|
+
paths: undefined,
|
|
277
|
+
},
|
|
278
|
+
];
|
|
279
|
+
},
|
|
280
|
+
async setInspectionDecision(materialID, inspType, process, inspect) {
|
|
281
|
+
const evtMat = findMatById(await events, materialID) ??
|
|
282
|
+
new api.LogMaterial({
|
|
283
|
+
id: materialID,
|
|
284
|
+
uniq: "",
|
|
285
|
+
part: "",
|
|
286
|
+
proc: process,
|
|
287
|
+
numproc: 1,
|
|
288
|
+
face: 1,
|
|
289
|
+
});
|
|
290
|
+
const evt = {
|
|
291
|
+
counter: 0,
|
|
292
|
+
material: [evtMat],
|
|
293
|
+
pal: 0,
|
|
294
|
+
type: api.LogType.Inspection,
|
|
295
|
+
startofcycle: false,
|
|
296
|
+
endUTC: new Date(),
|
|
297
|
+
loc: "Inspection",
|
|
298
|
+
locnum: 1,
|
|
299
|
+
result: inspect.toString(),
|
|
300
|
+
program: "",
|
|
301
|
+
elapsed: "00:00:00",
|
|
302
|
+
active: "00:00:00",
|
|
303
|
+
details: {
|
|
304
|
+
InspectionType: inspType,
|
|
305
|
+
},
|
|
306
|
+
};
|
|
307
|
+
return data.then(() => events.then((evts) => {
|
|
308
|
+
evts.push(evt);
|
|
309
|
+
return evt;
|
|
310
|
+
}));
|
|
311
|
+
},
|
|
312
|
+
async recordInspectionCompleted(insp) {
|
|
313
|
+
const evtMat = findMatById(await events, insp.materialID) ??
|
|
314
|
+
new api.LogMaterial({
|
|
315
|
+
id: insp.materialID,
|
|
316
|
+
uniq: "",
|
|
317
|
+
part: "",
|
|
318
|
+
proc: insp.process,
|
|
319
|
+
numproc: 1,
|
|
320
|
+
face: 1,
|
|
321
|
+
});
|
|
322
|
+
const evt = {
|
|
323
|
+
counter: 0,
|
|
324
|
+
material: [evtMat],
|
|
325
|
+
pal: 0,
|
|
326
|
+
type: api.LogType.InspectionResult,
|
|
327
|
+
startofcycle: false,
|
|
328
|
+
endUTC: new Date(),
|
|
329
|
+
loc: "InspectionComplete",
|
|
330
|
+
locnum: insp.inspectionLocationNum,
|
|
331
|
+
result: insp.success.toString(),
|
|
332
|
+
program: insp.inspectionType ?? "",
|
|
333
|
+
elapsed: insp.elapsed,
|
|
334
|
+
active: insp.active,
|
|
335
|
+
details: insp.extraData,
|
|
336
|
+
};
|
|
337
|
+
return data.then(() => events.then((evts) => {
|
|
338
|
+
evts.push(evt);
|
|
339
|
+
return evt;
|
|
340
|
+
}));
|
|
341
|
+
},
|
|
342
|
+
async recordCloseoutCompleted(closeout) {
|
|
343
|
+
const evtMat = findMatById(await events, closeout.materialID) ??
|
|
344
|
+
new api.LogMaterial({
|
|
345
|
+
id: closeout.materialID,
|
|
346
|
+
uniq: "",
|
|
347
|
+
part: "",
|
|
348
|
+
proc: closeout.process,
|
|
349
|
+
numproc: 1,
|
|
350
|
+
face: 1,
|
|
351
|
+
});
|
|
352
|
+
const evt = {
|
|
353
|
+
counter: 0,
|
|
354
|
+
material: [evtMat],
|
|
355
|
+
pal: 0,
|
|
356
|
+
type: api.LogType.CloseOut,
|
|
357
|
+
startofcycle: false,
|
|
358
|
+
endUTC: new Date(),
|
|
359
|
+
loc: "CloseOut",
|
|
360
|
+
locnum: closeout.locationNum,
|
|
361
|
+
result: "",
|
|
362
|
+
program: "",
|
|
363
|
+
elapsed: closeout.elapsed,
|
|
364
|
+
active: closeout.active,
|
|
365
|
+
details: closeout.extraData,
|
|
366
|
+
};
|
|
367
|
+
return data.then(() => events.then((evts) => {
|
|
368
|
+
evts.push(evt);
|
|
369
|
+
return evt;
|
|
370
|
+
}));
|
|
371
|
+
},
|
|
372
|
+
async setWorkorder(materialID, process, workorder) {
|
|
373
|
+
const evtMat = findMatById(await events, materialID) ??
|
|
374
|
+
new api.LogMaterial({
|
|
375
|
+
id: materialID,
|
|
376
|
+
uniq: "",
|
|
377
|
+
part: "",
|
|
378
|
+
proc: process,
|
|
379
|
+
numproc: 1,
|
|
380
|
+
face: 1,
|
|
381
|
+
});
|
|
382
|
+
const evt = {
|
|
383
|
+
counter: 0,
|
|
384
|
+
material: [evtMat],
|
|
385
|
+
pal: 0,
|
|
386
|
+
type: api.LogType.OrderAssignment,
|
|
387
|
+
startofcycle: false,
|
|
388
|
+
endUTC: new Date(),
|
|
389
|
+
loc: "OrderAssignment",
|
|
390
|
+
locnum: 1,
|
|
391
|
+
result: workorder,
|
|
392
|
+
program: "",
|
|
393
|
+
elapsed: "00:00:00",
|
|
394
|
+
active: "00:00:00",
|
|
395
|
+
};
|
|
396
|
+
return data.then(() => events.then((evts) => {
|
|
397
|
+
evts.push(evt);
|
|
398
|
+
return evt;
|
|
399
|
+
}));
|
|
400
|
+
},
|
|
401
|
+
getActiveWorkorder() {
|
|
402
|
+
return Promise.resolve([]);
|
|
403
|
+
},
|
|
404
|
+
recordOperatorNotes(materialID, process, operatorName, notes) {
|
|
405
|
+
const mat = new api.LogMaterial({
|
|
406
|
+
id: materialID,
|
|
407
|
+
uniq: "",
|
|
408
|
+
part: "",
|
|
409
|
+
proc: process,
|
|
410
|
+
numproc: 1,
|
|
411
|
+
face: 0,
|
|
412
|
+
});
|
|
413
|
+
const evt = {
|
|
414
|
+
counter: 0,
|
|
415
|
+
material: [mat],
|
|
416
|
+
pal: 0,
|
|
417
|
+
type: api.LogType.GeneralMessage,
|
|
418
|
+
startofcycle: false,
|
|
419
|
+
endUTC: new Date(),
|
|
420
|
+
loc: "Message",
|
|
421
|
+
locnum: 1,
|
|
422
|
+
result: "Operator Notes",
|
|
423
|
+
program: "OperatorNotes",
|
|
424
|
+
elapsed: "00:00:00",
|
|
425
|
+
active: "00:00:00",
|
|
426
|
+
details: {
|
|
427
|
+
operator: operatorName || "",
|
|
428
|
+
note: notes,
|
|
429
|
+
},
|
|
430
|
+
};
|
|
431
|
+
return data.then(() => events.then((evts) => {
|
|
432
|
+
evts.push(evt);
|
|
433
|
+
return evt;
|
|
434
|
+
}));
|
|
435
|
+
},
|
|
436
|
+
recordWorkorderComment(workorder, operName, comment) {
|
|
437
|
+
return Promise.resolve({
|
|
438
|
+
counter: 0,
|
|
439
|
+
material: [],
|
|
440
|
+
pal: 0,
|
|
441
|
+
type: api.LogType.WorkorderComment,
|
|
442
|
+
startofcycle: false,
|
|
443
|
+
endUTC: new Date(),
|
|
444
|
+
loc: "WorkorderComment",
|
|
445
|
+
locnum: 1,
|
|
446
|
+
result: workorder,
|
|
447
|
+
program: "",
|
|
448
|
+
elapsed: "PT0S",
|
|
449
|
+
active: "PT0S",
|
|
450
|
+
details: {
|
|
451
|
+
Comment: comment,
|
|
452
|
+
Operator: operName ?? "",
|
|
453
|
+
},
|
|
454
|
+
});
|
|
455
|
+
},
|
|
456
|
+
cancelRebooking(bookingId) {
|
|
457
|
+
return Promise.resolve({
|
|
458
|
+
counter: 0,
|
|
459
|
+
material: [],
|
|
460
|
+
pal: 0,
|
|
461
|
+
type: api.LogType.CancelRebooking,
|
|
462
|
+
startofcycle: false,
|
|
463
|
+
endUTC: new Date(),
|
|
464
|
+
loc: "Rebooking",
|
|
465
|
+
locnum: 1,
|
|
466
|
+
result: bookingId,
|
|
467
|
+
program: "",
|
|
468
|
+
elapsed: "PT0S",
|
|
469
|
+
active: "PT0S",
|
|
470
|
+
});
|
|
471
|
+
},
|
|
472
|
+
requestRebooking(partName, qty, workorder, priority, notes) {
|
|
473
|
+
return Promise.resolve({
|
|
474
|
+
counter: 0,
|
|
475
|
+
material: [],
|
|
476
|
+
pal: 0,
|
|
477
|
+
type: api.LogType.Rebooking,
|
|
478
|
+
startofcycle: false,
|
|
479
|
+
endUTC: new Date(),
|
|
480
|
+
loc: "Rebooking",
|
|
481
|
+
locnum: priority ?? 0,
|
|
482
|
+
result: "Rebooking",
|
|
483
|
+
program: partName,
|
|
484
|
+
elapsed: "PT0S",
|
|
485
|
+
active: "PT0S",
|
|
486
|
+
details: {
|
|
487
|
+
Quantity: qty?.toString() ?? "1",
|
|
488
|
+
Workorder: workorder ?? "",
|
|
489
|
+
Notes: notes ?? "",
|
|
490
|
+
},
|
|
491
|
+
});
|
|
492
|
+
},
|
|
493
|
+
};
|
|
494
|
+
const machineB = {
|
|
495
|
+
getToolsInMachines() {
|
|
496
|
+
return data.then((d) => d.tools ?? []);
|
|
497
|
+
},
|
|
498
|
+
getProgramsInCellController() {
|
|
499
|
+
return data.then((d) => d.programs ?? []);
|
|
500
|
+
},
|
|
501
|
+
getProgramRevisionContent(program) {
|
|
502
|
+
return Promise.resolve("GCODE for " + program + " would be here");
|
|
503
|
+
},
|
|
504
|
+
getLatestProgramRevisionContent(program) {
|
|
505
|
+
return Promise.resolve("GCODE for " + program + " would be here");
|
|
506
|
+
},
|
|
507
|
+
getProgramRevisionsInDescendingOrderOfRevision() {
|
|
508
|
+
return Promise.resolve([]);
|
|
509
|
+
},
|
|
510
|
+
};
|
|
511
|
+
registerBackend(logB, jobsB, fmsB, machineB);
|
|
512
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as api from "./api.js";
|
|
2
|
+
import { User } from "oidc-client-ts";
|
|
3
|
+
export interface JobAPI {
|
|
4
|
+
history(startUTC: Date, endUTC: Date): Promise<Readonly<api.IHistoricData>>;
|
|
5
|
+
recent(startUTC: Date, alreadyKnownSchIds: string[]): Promise<Readonly<api.IRecentHistoricData>>;
|
|
6
|
+
currentStatus(): Promise<Readonly<api.ICurrentStatus>>;
|
|
7
|
+
setJobComment(unique: string, comment: string): Promise<void>;
|
|
8
|
+
removeMaterialFromAllQueues(materialId: number, operatorName: string | undefined): Promise<void>;
|
|
9
|
+
bulkRemoveMaterialFromQueues(operatorName: string | null, materialIds: ReadonlyArray<number> | null): Promise<void>;
|
|
10
|
+
setMaterialInQueue(materialId: number, operatorName: string | null, queue: api.QueuePosition): Promise<void>;
|
|
11
|
+
addUnprocessedMaterialToQueue(jobUnique: string, lastCompletedProcess: number, queue: string, pos: number, operatorName: string | null, workorder: string | null, serial: string): Promise<Readonly<api.IInProcessMaterial> | undefined>;
|
|
12
|
+
addUnallocatedCastingToQueue(castingName: string, queue: string, qty: number, operatrorName: string | null, workorder: string | null, serials: string[]): Promise<ReadonlyArray<Readonly<api.IInProcessMaterial>>>;
|
|
13
|
+
signalMaterialForQuarantine(materialId: number, operName: string | null, reason: string | undefined): Promise<void>;
|
|
14
|
+
swapMaterialOnPallet(materialId: number, operName: string | null, mat: Readonly<api.IMatToPutOnPallet>): Promise<void>;
|
|
15
|
+
invalidatePalletCycle(materialId: number, operName: string | null | undefined, changeCastingTo: string | null | undefined, changeJobUniqueTo: string | null | undefined, process: number): Promise<Readonly<api.IMaterialDetails> | null | undefined>;
|
|
16
|
+
unscheduledRebookings(signal?: AbortSignal): Promise<ReadonlyArray<Readonly<api.IRebooking>>>;
|
|
17
|
+
}
|
|
18
|
+
export interface FmsAPI {
|
|
19
|
+
fMSInformation(): Promise<Readonly<api.IFMSInfo>>;
|
|
20
|
+
printLabel(materialId: number, process: number): Promise<void>;
|
|
21
|
+
parseBarcode(barcode: string | null, queuesToAddTo: ReadonlyArray<string> | null | undefined): Promise<Readonly<api.IScannedMaterial | null>>;
|
|
22
|
+
enableVerboseLoggingForFiveMinutes(): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
export interface LogAPI {
|
|
25
|
+
get(startUTC: Date, endUTC: Date, signal?: AbortSignal): Promise<ReadonlyArray<Readonly<api.ILogEntry>>>;
|
|
26
|
+
recent(lastSeenCounter: number, expectedEndUTCofLastSeen: Date | null | undefined): Promise<ReadonlyArray<Readonly<api.ILogEntry>>>;
|
|
27
|
+
logForMaterial(materialID: number, signal?: AbortSignal): Promise<ReadonlyArray<Readonly<api.ILogEntry>>>;
|
|
28
|
+
logForMaterials(materialIDs: ReadonlyArray<number> | null | undefined): Promise<ReadonlyArray<Readonly<api.ILogEntry>>>;
|
|
29
|
+
logForSerial(serial: string, signal?: AbortSignal): Promise<ReadonlyArray<Readonly<api.ILogEntry>>>;
|
|
30
|
+
materialForSerial(serial: string | null): Promise<ReadonlyArray<Readonly<api.IMaterialDetails>>>;
|
|
31
|
+
setInspectionDecision(materialID: number, inspType: string, process: number, inspect: boolean): Promise<Readonly<api.ILogEntry>>;
|
|
32
|
+
recordInspectionCompleted(insp: api.NewInspectionCompleted): Promise<Readonly<api.ILogEntry>>;
|
|
33
|
+
recordCloseoutCompleted(insp: api.NewCloseout): Promise<Readonly<api.ILogEntry>>;
|
|
34
|
+
setWorkorder(materialID: number, process: number, workorder: string): Promise<Readonly<api.ILogEntry>>;
|
|
35
|
+
recordOperatorNotes(materialID: number, process: number, operatorName: string | null, notes: string): Promise<Readonly<api.ILogEntry>>;
|
|
36
|
+
recordWorkorderComment(workorder: string, operName: string | null | undefined, comment: string): Promise<Readonly<api.ILogEntry>>;
|
|
37
|
+
getActiveWorkorder(workorder: string, signal?: AbortSignal): Promise<ReadonlyArray<Readonly<api.IActiveWorkorder>>>;
|
|
38
|
+
cancelRebooking(bookingId: string): Promise<Readonly<api.ILogEntry>>;
|
|
39
|
+
requestRebooking(partName: string, qty: number | undefined, workorder: string | null | undefined, priority: number | null | undefined, notes: string | undefined): Promise<Readonly<api.ILogEntry>>;
|
|
40
|
+
}
|
|
41
|
+
export interface MachineAPI {
|
|
42
|
+
getToolsInMachines(): Promise<ReadonlyArray<Readonly<api.IToolInMachine>>>;
|
|
43
|
+
getProgramsInCellController(): Promise<ReadonlyArray<Readonly<api.IProgramInCellController>>>;
|
|
44
|
+
getProgramRevisionContent(program: string, revision: number): Promise<string>;
|
|
45
|
+
getLatestProgramRevisionContent(program: string): Promise<string>;
|
|
46
|
+
getProgramRevisionsInDescendingOrderOfRevision(programName: string | null, count: number, revisionToStart: number | undefined): Promise<ReadonlyArray<Readonly<api.IProgramRevision>>>;
|
|
47
|
+
}
|
|
48
|
+
export declare let FmsServerBackend: FmsAPI;
|
|
49
|
+
export declare let JobsBackend: JobAPI;
|
|
50
|
+
export declare let LogBackend: LogAPI;
|
|
51
|
+
export declare let MachineBackend: MachineAPI;
|
|
52
|
+
export declare let OtherLogBackends: ReadonlyArray<LogAPI>;
|
|
53
|
+
export declare function registerNetworkBackend(): void;
|
|
54
|
+
export declare function setOtherLogBackends(servers: ReadonlyArray<string>): void;
|
|
55
|
+
export declare function registerBackend(log: LogAPI, job: JobAPI, fms: FmsAPI, machine: MachineAPI): void;
|
|
56
|
+
export declare function setUserToken(u: User): void;
|
|
57
|
+
export declare function instructionUrl(partName: string, type: string, matId: number, pallet: number | null, proc: number | null | undefined, operator: string | null): string;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/* Copyright (c) 2020, John Lenz
|
|
2
|
+
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
* Redistributions of source code must retain the above copyright
|
|
9
|
+
notice, this list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
* Redistributions in binary form must reproduce the above
|
|
12
|
+
copyright notice, this list of conditions and the following
|
|
13
|
+
disclaimer in the documentation and/or other materials provided
|
|
14
|
+
with the distribution.
|
|
15
|
+
|
|
16
|
+
* Neither the name of John Lenz, Black Maple Software, SeedTactics,
|
|
17
|
+
nor the names of other contributors may be used to endorse or
|
|
18
|
+
promote products derived from this software without specific
|
|
19
|
+
prior written permission.
|
|
20
|
+
|
|
21
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
22
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
23
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
24
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
25
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
26
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
27
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
28
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
29
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
30
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
31
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
32
|
+
*/
|
|
33
|
+
import * as api from "./api.js";
|
|
34
|
+
export let FmsServerBackend;
|
|
35
|
+
export let JobsBackend;
|
|
36
|
+
export let LogBackend;
|
|
37
|
+
export let MachineBackend;
|
|
38
|
+
let otherLogServers = [];
|
|
39
|
+
export let OtherLogBackends = [];
|
|
40
|
+
export function registerNetworkBackend() {
|
|
41
|
+
LogBackend = new api.LogClient();
|
|
42
|
+
MachineBackend = new api.MachinesClient();
|
|
43
|
+
JobsBackend = new api.JobsClient();
|
|
44
|
+
FmsServerBackend = new api.FmsClient();
|
|
45
|
+
}
|
|
46
|
+
export function setOtherLogBackends(servers) {
|
|
47
|
+
otherLogServers = servers;
|
|
48
|
+
OtherLogBackends = servers.map((s) => new api.LogClient(s));
|
|
49
|
+
}
|
|
50
|
+
export function registerBackend(log, job, fms, machine) {
|
|
51
|
+
LogBackend = log;
|
|
52
|
+
JobsBackend = job;
|
|
53
|
+
FmsServerBackend = fms;
|
|
54
|
+
MachineBackend = machine;
|
|
55
|
+
}
|
|
56
|
+
export function setUserToken(u) {
|
|
57
|
+
const token = u.access_token;
|
|
58
|
+
function fetch(url, init) {
|
|
59
|
+
return window.fetch(url, init
|
|
60
|
+
? { ...init, headers: { ...init.headers, Authorization: "Bearer " + token } }
|
|
61
|
+
: { headers: { Authorization: "Bearer " + token } });
|
|
62
|
+
}
|
|
63
|
+
FmsServerBackend = new api.FmsClient(undefined, { fetch });
|
|
64
|
+
JobsBackend = new api.JobsClient(undefined, { fetch });
|
|
65
|
+
LogBackend = new api.LogClient(undefined, { fetch });
|
|
66
|
+
OtherLogBackends = otherLogServers.map((s) => new api.LogClient(s, { fetch }));
|
|
67
|
+
}
|
|
68
|
+
export function instructionUrl(partName, type, matId, pallet, proc, operator) {
|
|
69
|
+
return ("/api/v1/fms/find-instructions/" +
|
|
70
|
+
encodeURIComponent(partName) +
|
|
71
|
+
"?type=" +
|
|
72
|
+
encodeURIComponent(type) +
|
|
73
|
+
("&materialID=" + matId.toString()) +
|
|
74
|
+
(proc !== null && proc !== undefined ? "&process=" + proc.toString() : "") +
|
|
75
|
+
(operator !== null ? "&operatorName=" + encodeURIComponent(operator) : "") +
|
|
76
|
+
(pallet ? "&pallet=" + encodeURIComponent(pallet) : ""));
|
|
77
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Atom } from "jotai";
|
|
2
|
+
export declare const selectedMonth: import("jotai").WritableAtom<Date, [m: Date], void>;
|
|
3
|
+
export type SelectedAnalysisPeriod = {
|
|
4
|
+
type: "Last30";
|
|
5
|
+
} | {
|
|
6
|
+
type: "SpecificMonth";
|
|
7
|
+
month: Date;
|
|
8
|
+
};
|
|
9
|
+
export declare const selectedAnalysisPeriod: Atom<SelectedAnalysisPeriod>;
|
|
10
|
+
export declare const loadingSpecificMonthData: Atom<boolean>;
|
|
11
|
+
export declare const errorLoadingSpecificMonthData: Atom<string | null>;
|
|
12
|
+
export declare function useSetLast30(): () => void;
|
|
13
|
+
export declare function useSetSpecificMonthWithoutLoading(): (m: Date) => void;
|