@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,120 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/* Copyright (c) 2023, John Lenz
|
|
3
|
+
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
* Redistributions of source code must retain the above copyright
|
|
10
|
+
notice, this list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
* Redistributions in binary form must reproduce the above
|
|
13
|
+
copyright notice, this list of conditions and the following
|
|
14
|
+
disclaimer in the documentation and/or other materials provided
|
|
15
|
+
with the distribution.
|
|
16
|
+
|
|
17
|
+
* Neither the name of John Lenz, Black Maple Software, SeedTactics,
|
|
18
|
+
nor the names of other contributors may be used to endorse or
|
|
19
|
+
promote products derived from this software without specific
|
|
20
|
+
prior written permission.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
23
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
24
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
25
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
26
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
27
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
28
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
29
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
30
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
31
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
32
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
33
|
+
*/
|
|
34
|
+
import { useTransition } from "react";
|
|
35
|
+
import { Notifications, HelpOutline, ExitToApp } from "@mui/icons-material";
|
|
36
|
+
import { Typography, Tooltip, Badge, IconButton, AppBar, Toolbar, Box, List, ListItem, ListItemIcon, ListItemButton, ListItemText, ListSubheader, Paper, Select, MenuItem, FormControl, } from "@mui/material";
|
|
37
|
+
import { startOfToday, differenceInDays } from "date-fns";
|
|
38
|
+
import { currentStatus } from "../cell-status/current-status";
|
|
39
|
+
import { SeedtacticLogo } from "../seedtactics-logo";
|
|
40
|
+
import { OperatorSelect } from "./ChooseOperator";
|
|
41
|
+
import { LoadingIcon } from "./LoadingIcon";
|
|
42
|
+
import { ManualSerialEntryButton } from "./ManualSerialEntry";
|
|
43
|
+
import { CustomStationMonitorDialog } from "./station-monitor/CustomStationMonitorDialog";
|
|
44
|
+
import { currentRoute, helpUrl } from "./routes";
|
|
45
|
+
import { fmsInformation, logout } from "../network/server-settings";
|
|
46
|
+
import { useAtom, useAtomValue } from "jotai";
|
|
47
|
+
import { QRScanButton } from "./BarcodeScanning";
|
|
48
|
+
function ShowLicense({ d }) {
|
|
49
|
+
const today = startOfToday();
|
|
50
|
+
const diff = differenceInDays(d, today);
|
|
51
|
+
if (diff > 7) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
else if (diff >= 0) {
|
|
55
|
+
return _jsxs(Typography, { variant: "subtitle1", children: ["License expires on ", d.toDateString()] });
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
return _jsxs(Typography, { variant: "h6", children: ["License expired on ", d.toDateString()] });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function Brand() {
|
|
62
|
+
const fmsInfo = useAtomValue(fmsInformation);
|
|
63
|
+
let tooltip = "";
|
|
64
|
+
if (fmsInfo.name) {
|
|
65
|
+
tooltip = (fmsInfo.name || "") + " " + (fmsInfo.version || "");
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
tooltip = "SeedTactic FMS Insight";
|
|
69
|
+
}
|
|
70
|
+
return (_jsxs(_Fragment, { children: [_jsx(Tooltip, { title: tooltip, children: _jsx("div", { children: _jsx(SeedtacticLogo, {}) }) }), _jsx(Typography, { variant: "h6", style: { marginLeft: "1em", marginRight: "2em" }, children: "Insight" }), fmsInfo?.licenseExpires ? _jsx(ShowLicense, { d: fmsInfo.licenseExpires }) : undefined] }));
|
|
71
|
+
}
|
|
72
|
+
function Alarms() {
|
|
73
|
+
const alarms = useAtomValue(currentStatus).alarms;
|
|
74
|
+
const hasAlarms = alarms && alarms.length > 0;
|
|
75
|
+
const alarmTooltip = hasAlarms ? alarms.join(". ") : "No Alarms";
|
|
76
|
+
return (_jsx(Tooltip, { title: alarmTooltip, children: _jsx(Badge, { badgeContent: hasAlarms ? alarms.length : 0, children: _jsx(Notifications, { color: hasAlarms ? "error" : undefined }) }) }));
|
|
77
|
+
}
|
|
78
|
+
function HelpButton() {
|
|
79
|
+
const route = useAtomValue(currentRoute);
|
|
80
|
+
return (_jsx(Tooltip, { title: "Help", children: _jsx(IconButton, { "aria-label": "Help", href: helpUrl(route), target: "_help", size: "large", children: _jsx(HelpOutline, {}) }) }));
|
|
81
|
+
}
|
|
82
|
+
function LogoutButton() {
|
|
83
|
+
return (_jsx(Tooltip, { title: "Logout", children: _jsx(IconButton, { "aria-label": "Logout", onClick: logout, size: "large", children: _jsx(ExitToApp, {}) }) }));
|
|
84
|
+
}
|
|
85
|
+
function ToolButtons({ showAlarms, showLogout, showSearch, }) {
|
|
86
|
+
return (_jsxs(_Fragment, { children: [_jsx(LoadingIcon, {}), _jsx(CustomStationMonitorDialog, {}), showSearch ? _jsx(QRScanButton, {}) : undefined, showSearch ? _jsx(ManualSerialEntryButton, {}) : undefined, _jsx(HelpButton, {}), showLogout ? _jsx(LogoutButton, {}) : undefined, showAlarms ? _jsx(Alarms, {}) : undefined] }));
|
|
87
|
+
}
|
|
88
|
+
function MenuNavSelect({ menuNavs }) {
|
|
89
|
+
const fmsInfo = useAtomValue(fmsInformation);
|
|
90
|
+
const [curRoute, setCurrentRoute] = useAtom(currentRoute);
|
|
91
|
+
const [isPending, startTransition] = useTransition();
|
|
92
|
+
return (_jsx(FormControl, { size: "small", children: _jsx(Select, { value: curRoute.route, sx: { width: "16.5em" }, onChange: (e) => startTransition(() => {
|
|
93
|
+
const item = menuNavs.find((i) => "separator" in i ? false : i.route.route === e.target.value);
|
|
94
|
+
if (!item || "separator" in item)
|
|
95
|
+
return;
|
|
96
|
+
setCurrentRoute(item.route);
|
|
97
|
+
}), renderValue: () => {
|
|
98
|
+
const item = menuNavs.find((i) => ("separator" in i ? false : i.route.route === curRoute.route));
|
|
99
|
+
if (!item || "separator" in item)
|
|
100
|
+
return null;
|
|
101
|
+
return (_jsxs(Box, { display: "flex", alignItems: "center", children: [item.icon, _jsxs(Typography, { variant: "h6", style: { marginLeft: "1em" }, children: [typeof item.name === "string" ? item.name : item.name(fmsInfo), isPending ? "..." : ""] })] }));
|
|
102
|
+
}, children: menuNavs.map((item, idx) => "separator" in item ? (_jsx(ListSubheader, { children: item.separator }, item.separator)) : item.hidden?.(fmsInfo) ? undefined : (_jsxs(MenuItem, { value: item.route.route, children: [_jsx(ListItemIcon, { children: item.icon }), _jsx(ListItemText, { primary: typeof item.name === "string" ? item.name : item.name(fmsInfo) })] }, idx))) }) }));
|
|
103
|
+
}
|
|
104
|
+
export function Header({ showAlarms, showLogout, showSearch, showOperator, Nav1, Nav2, menuNavs, }) {
|
|
105
|
+
return (_jsxs(_Fragment, { children: [_jsx(AppBar, { position: "static", sx: { display: { xs: "none", md: "block" } }, children: _jsx(Toolbar, { children: _jsxs(Box, { display: "grid", gridTemplateColumns: Nav2 ? "1fr auto 1fr" : "minmax(200px, 1fr) auto", width: "100vw", gridTemplateAreas: Nav2 ? '"nav navCenter tools"' : '"nav tools"', children: [_jsxs(Box, { gridArea: "nav", display: "flex", alignItems: "center", children: [_jsx(Brand, {}), Nav1 ? _jsx(Nav1, {}) : undefined] }), Nav2 ? (_jsx(Box, { gridArea: "navCenter", children: _jsx(Nav2, {}) })) : undefined, _jsxs(Box, { gridArea: "tools", display: "flex", alignItems: "center", justifyContent: "flex-end", children: [showOperator ? _jsx(OperatorSelect, {}) : undefined, _jsx(ToolButtons, { showAlarms, showLogout, showSearch })] })] }) }) }), _jsxs(AppBar, { position: "static", sx: { display: { xs: "block", md: "none" } }, children: [_jsxs(Toolbar, { children: [_jsx(Brand, {}), _jsx("div", { style: { flexGrow: 1 } }), _jsx(ToolButtons, { showAlarms, showLogout, showSearch })] }), _jsxs(Box, { display: "grid", gridTemplateColumns: "minmax(200px, 1fr) auto", children: [_jsx(Box, { gridColumn: "1", children: Nav1 ? _jsx(Nav1, {}) : undefined }), _jsx(Box, { gridColumn: "2", children: Nav2 ? _jsx(Nav2, {}) : undefined })] })] }), menuNavs && menuNavs.length > 0 ? (_jsx(Paper, { elevation: 4, square: true, component: "nav", sx: { display: { xs: "block", xl: "none" }, padding: "2px" }, children: _jsx(MenuNavSelect, { menuNavs: menuNavs }) })) : undefined] }));
|
|
106
|
+
}
|
|
107
|
+
export function SideMenu({ menuItems }) {
|
|
108
|
+
const fmsInfo = useAtomValue(fmsInformation);
|
|
109
|
+
const [curRoute, setCurrentRoute] = useAtom(currentRoute);
|
|
110
|
+
const [isPending, startTransition] = useTransition();
|
|
111
|
+
if (!menuItems || menuItems.length === 0) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
return (_jsx(Paper, { elevation: 3, square: true, sx: {
|
|
115
|
+
flexShrink: 0,
|
|
116
|
+
display: { xs: "none", xl: "block" },
|
|
117
|
+
minHeight: "calc(100vh - 64px)",
|
|
118
|
+
zIndex: 1,
|
|
119
|
+
}, children: _jsx(List, { dense: true, children: menuItems?.map((item, idx) => "separator" in item ? (_jsx(ListSubheader, { children: item.separator }, item.separator)) : item.hidden?.(fmsInfo) ? undefined : (_jsx(ListItem, { children: _jsxs(ListItemButton, { selected: curRoute.route === item.route.route, onClick: () => startTransition(() => setCurrentRoute(item.route)), children: [_jsx(ListItemIcon, { children: item.icon }), _jsx(ListItemText, { primary: typeof item.name === "string" ? item.name : item.name(fmsInfo), sx: isPending ? (theme) => ({ color: theme.palette.grey[700] }) : undefined })] }) }, idx))) }) }));
|
|
120
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function VerboseLoggingPage(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* Copyright (c) 2023, John Lenz
|
|
3
|
+
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
* Redistributions of source code must retain the above copyright
|
|
10
|
+
notice, this list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
* Redistributions in binary form must reproduce the above
|
|
13
|
+
copyright notice, this list of conditions and the following
|
|
14
|
+
disclaimer in the documentation and/or other materials provided
|
|
15
|
+
with the distribution.
|
|
16
|
+
|
|
17
|
+
* Neither the name of John Lenz, Black Maple Software, SeedTactics,
|
|
18
|
+
nor the names of other contributors may be used to endorse or
|
|
19
|
+
promote products derived from this software without specific
|
|
20
|
+
prior written permission.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
23
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
24
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
25
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
26
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
27
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
28
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
29
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
30
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
31
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
32
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
33
|
+
*/
|
|
34
|
+
import { Button } from "@mui/material";
|
|
35
|
+
import { useState } from "react";
|
|
36
|
+
import { FmsServerBackend } from "../network/backend.js";
|
|
37
|
+
export function VerboseLoggingPage() {
|
|
38
|
+
const [enabled, setEnabled] = useState(false);
|
|
39
|
+
function enable() {
|
|
40
|
+
setEnabled(true);
|
|
41
|
+
void FmsServerBackend.enableVerboseLoggingForFiveMinutes();
|
|
42
|
+
setTimeout(() => setEnabled(false), 5 * 60 * 1000);
|
|
43
|
+
}
|
|
44
|
+
return (_jsx("main", { style: { marginTop: "4em" }, children: _jsxs("div", { style: { maxWidth: "50em", marginLeft: "auto", marginRight: "auto", textAlign: "center" }, children: [_jsx("p", { style: {
|
|
45
|
+
marginBottom: "1em",
|
|
46
|
+
}, children: "Verbose logging generates a large amount of additional data in the FMS Insight Server debug log file." }), _jsx(Button, { disabled: enabled, onClick: enable, variant: "contained", children: enabled ? (_jsx("span", { children: "Verbose Logging is Enabled" })) : (_jsx("span", { children: "Enable Verbose Logging For 5 minutes" })) })] }) }));
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AnalysisSelectToolbar: import("react").NamedExoticComponent<object>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* Copyright (c) 2018, John Lenz
|
|
3
|
+
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
* Redistributions of source code must retain the above copyright
|
|
10
|
+
notice, this list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
* Redistributions in binary form must reproduce the above
|
|
13
|
+
copyright notice, this list of conditions and the following
|
|
14
|
+
disclaimer in the documentation and/or other materials provided
|
|
15
|
+
with the distribution.
|
|
16
|
+
|
|
17
|
+
* Neither the name of John Lenz, Black Maple Software, SeedTactics,
|
|
18
|
+
nor the names of other contributors may be used to endorse or
|
|
19
|
+
promote products derived from this software without specific
|
|
20
|
+
prior written permission.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
23
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
24
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
25
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
26
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
27
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
28
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
29
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
30
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
31
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
32
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
33
|
+
*/
|
|
34
|
+
import { memo } from "react";
|
|
35
|
+
import { Radio, Stack } from "@mui/material";
|
|
36
|
+
import { FormControlLabel } from "@mui/material";
|
|
37
|
+
import MonthSelect from "../MonthSelect.js";
|
|
38
|
+
import { selectedAnalysisPeriod, selectedMonth, useSetSpecificMonthWithoutLoading, useSetLast30, } from "../../network/load-specific-month.js";
|
|
39
|
+
import { useAtom, useAtomValue } from "jotai";
|
|
40
|
+
export const AnalysisSelectToolbar = memo(function AnalysisSelectToolbar() {
|
|
41
|
+
const period = useAtomValue(selectedAnalysisPeriod);
|
|
42
|
+
const [selMonth, analyzeMonth] = useAtom(selectedMonth);
|
|
43
|
+
const setMonthWithoutLoading = useSetSpecificMonthWithoutLoading();
|
|
44
|
+
const setLast30 = useSetLast30();
|
|
45
|
+
return (_jsxs(Stack, { component: "nav", direction: "row", spacing: 3, paddingLeft: "24px", paddingRight: "24px", alignItems: "center", children: [_jsx(FormControlLabel, { control: _jsx(Radio, { checked: period.type === "Last30", color: "secondary", onChange: (e, checked) => (checked ? setLast30() : null) }), label: "Last 30 days" }), _jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [_jsx(FormControlLabel, { control: _jsx(Radio, { checked: period.type === "SpecificMonth", color: "secondary", onChange: (e, checked) => (checked ? analyzeMonth(selMonth) : null) }), label: "Select Month" }), _jsx(MonthSelect, { curMonth: selMonth, onSelectMonth: (m) => {
|
|
46
|
+
if (period.type === "SpecificMonth") {
|
|
47
|
+
// if month type is selected, reload data
|
|
48
|
+
analyzeMonth(m);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
// otherwise, just store month
|
|
52
|
+
setMonthWithoutLoading(m);
|
|
53
|
+
}
|
|
54
|
+
} })] })] }));
|
|
55
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function BufferOccupancyChart(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* Copyright (c) 2025, John Lenz
|
|
3
|
+
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
* Redistributions of source code must retain the above copyright
|
|
10
|
+
notice, this list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
* Redistributions in binary form must reproduce the above
|
|
13
|
+
copyright notice, this list of conditions and the following
|
|
14
|
+
disclaimer in the documentation and/or other materials provided
|
|
15
|
+
with the distribution.
|
|
16
|
+
|
|
17
|
+
* Neither the name of John Lenz, Black Maple Software, SeedTactics,
|
|
18
|
+
nor the names of other contributors may be used to endorse or
|
|
19
|
+
promote products derived from this software without specific
|
|
20
|
+
prior written permission.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
23
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
24
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
25
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
26
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
27
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
28
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
29
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
30
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
31
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
32
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
33
|
+
*/
|
|
34
|
+
import { memo, useState, useMemo, useRef, useCallback } from "react";
|
|
35
|
+
import { addDays, startOfToday, addMonths } from "date-fns";
|
|
36
|
+
import { curveCatmullRom, line } from "d3-shape";
|
|
37
|
+
import { buildBufferChart } from "../../data/results.bufferchart.js";
|
|
38
|
+
import { seriesColor } from "../../util/chart-colors.js";
|
|
39
|
+
import { rawMaterialQueues } from "../../cell-status/names.js";
|
|
40
|
+
import { selectedAnalysisPeriod } from "../../network/load-specific-month.js";
|
|
41
|
+
import { last30BufferEntries, specificMonthBufferEntries } from "../../cell-status/buffers.js";
|
|
42
|
+
import { Box, ToggleButton, Slider, Typography, debounce } from "@mui/material";
|
|
43
|
+
import { useSetTitle } from "../routes.js";
|
|
44
|
+
import { useAtomValue } from "jotai";
|
|
45
|
+
import { HashSet, LazySeq } from "@seedtactics/immutable-collections";
|
|
46
|
+
import { scaleLinear, scaleTime } from "d3-scale";
|
|
47
|
+
import { AxisBottom, AxisLeft, ChartGrid } from "../AxisAndGrid.js";
|
|
48
|
+
import { useResizeDetector } from "react-resize-detector";
|
|
49
|
+
import { animated, useSpring } from "@react-spring/web";
|
|
50
|
+
import { interpolatePath } from "d3-interpolate-path";
|
|
51
|
+
const AnimatedPath = memo(function AnimatedPath({ series, xScale, yScale, color, }) {
|
|
52
|
+
const d = line()
|
|
53
|
+
.curve(curveCatmullRom)
|
|
54
|
+
.x((p) => xScale(p.x))
|
|
55
|
+
.y((p) => yScale(p.y))(series.points) ?? "";
|
|
56
|
+
// don't update in quick succession
|
|
57
|
+
const previous = useRef(d);
|
|
58
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
59
|
+
const setPrevious = useCallback(debounce((val) => {
|
|
60
|
+
previous.current = val;
|
|
61
|
+
}, 50), []);
|
|
62
|
+
const interpolate = interpolatePath(previous.current, d);
|
|
63
|
+
setPrevious(d);
|
|
64
|
+
const { t } = useSpring({
|
|
65
|
+
from: { t: 0 },
|
|
66
|
+
to: { t: 1 },
|
|
67
|
+
reset: true,
|
|
68
|
+
delay: 0,
|
|
69
|
+
});
|
|
70
|
+
return (_jsx(animated.path, { d: t.to(interpolate), stroke: color, strokeWidth: 2, strokeLinecap: "round", fill: "transparent" }));
|
|
71
|
+
});
|
|
72
|
+
const marginLeft = 60;
|
|
73
|
+
const marginBottom = 50;
|
|
74
|
+
const marginTop = 20;
|
|
75
|
+
const marginRight = 20;
|
|
76
|
+
function BufferChartSVG({ width, height, series, disabled, }) {
|
|
77
|
+
const [dateMin, dateMax] = useMemo(() => {
|
|
78
|
+
let min = null;
|
|
79
|
+
let max = null;
|
|
80
|
+
for (const s of series) {
|
|
81
|
+
for (const p of s.points) {
|
|
82
|
+
if (min === null || p.x < min) {
|
|
83
|
+
min = p.x;
|
|
84
|
+
}
|
|
85
|
+
if (max === null || p.x > max) {
|
|
86
|
+
max = p.x;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return [min ?? new Date(), max ?? new Date()];
|
|
91
|
+
}, [series]);
|
|
92
|
+
const xScale = useMemo(() => scaleTime()
|
|
93
|
+
.range([0, width - marginLeft - marginRight])
|
|
94
|
+
.domain([dateMin, dateMax]), [width, dateMin, dateMax]);
|
|
95
|
+
const yMax = height - marginBottom - marginTop;
|
|
96
|
+
const yScale = useMemo(() => scaleLinear()
|
|
97
|
+
.domain([
|
|
98
|
+
0,
|
|
99
|
+
LazySeq.of(series)
|
|
100
|
+
.flatMap((s) => s.points)
|
|
101
|
+
.map((p) => p.y)
|
|
102
|
+
.maxBy((y) => y) ?? 1,
|
|
103
|
+
])
|
|
104
|
+
.range([yMax, 0]), [series, yMax]);
|
|
105
|
+
return (_jsx("svg", { width: width, height: height, children: _jsxs("g", { transform: `translate(${marginLeft},${marginTop})`, children: [_jsx(AxisBottom, { scale: xScale, top: yMax }), _jsx(AxisLeft, { scale: yScale, left: 0, label: "Buffer Size" }), _jsx(ChartGrid, { xScale: xScale, yScale: yScale, width: width - marginLeft - marginRight, height: yMax }), series.map((s, idx) => disabled.has(s.label) ? undefined : (_jsx(AnimatedPath, { series: s, xScale: xScale, yScale: yScale, color: seriesColor(idx, series.length) }, s.label)))] }) }));
|
|
106
|
+
}
|
|
107
|
+
const BufferChart = memo(function BufferChart(props) {
|
|
108
|
+
const period = useAtomValue(selectedAnalysisPeriod);
|
|
109
|
+
const defaultDateRange = period.type === "Last30"
|
|
110
|
+
? [addDays(startOfToday(), -29), addDays(startOfToday(), 1)]
|
|
111
|
+
: [period.month, addMonths(period.month, 1)];
|
|
112
|
+
const entries = useAtomValue(period.type === "Last30" ? last30BufferEntries : specificMonthBufferEntries);
|
|
113
|
+
const rawMatQueues = useAtomValue(rawMaterialQueues);
|
|
114
|
+
const [disabledBuffers, setDisabledBuffers] = useState(HashSet.empty());
|
|
115
|
+
const defaultDateRangeStart = defaultDateRange[0];
|
|
116
|
+
const defaultDateRangeEnd = defaultDateRange[1];
|
|
117
|
+
const series = useMemo(() => buildBufferChart(defaultDateRangeStart, defaultDateRangeEnd, props.movingAverageDistanceInHours, rawMatQueues, entries.valuesToLazySeq()), [defaultDateRangeStart, defaultDateRangeEnd, entries, props.movingAverageDistanceInHours, rawMatQueues]);
|
|
118
|
+
const { width, height, ref: chartRef, } = useResizeDetector({
|
|
119
|
+
refreshMode: "debounce",
|
|
120
|
+
refreshRate: 100,
|
|
121
|
+
});
|
|
122
|
+
return (_jsxs("div", { children: [_jsx(Box, { ref: chartRef, sx: {
|
|
123
|
+
height: { xs: "calc(100vh - 350px)", md: "calc(100vh - 285px)", xl: "calc(100vh - 220px)" },
|
|
124
|
+
overflow: "hidden",
|
|
125
|
+
}, children: width && height && width > 0 && height > 0 && (_jsx(BufferChartSVG, { width: width, height: height, series: series, disabled: disabledBuffers })) }), _jsx("div", { style: { marginTop: "1em", display: "flex", flexWrap: "wrap", justifyContent: "space-around" }, children: series.map((s, idx) => (_jsx(ToggleButton, { selected: !disabledBuffers.has(s.label), value: s.label, onChange: () => setDisabledBuffers((db) => (db.has(s.label) ? db.delete(s.label) : db.add(s.label))), children: _jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [_jsx("div", { style: { width: "14px", height: "14px", backgroundColor: seriesColor(idx, series.length) } }), _jsx("div", { style: { marginLeft: "1em" }, children: s.label })] }) }, s.label))) })] }));
|
|
126
|
+
});
|
|
127
|
+
// https://github.com/mui-org/material-ui/issues/20191
|
|
128
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
129
|
+
const SliderAny = Slider;
|
|
130
|
+
export function BufferOccupancyChart() {
|
|
131
|
+
useSetTitle("Buffer Occupancy");
|
|
132
|
+
const [movingAverageHours, setMovingAverage] = useState(12);
|
|
133
|
+
return (_jsxs(Box, { paddingLeft: "24px", paddingRight: "24px", paddingTop: "10px", children: [_jsxs(Box, { component: "nav", sx: {
|
|
134
|
+
display: "flex",
|
|
135
|
+
minHeight: "2.5em",
|
|
136
|
+
alignItems: "center",
|
|
137
|
+
maxWidth: "calc(100vw - 24px - 24px)",
|
|
138
|
+
}, children: [_jsx(Typography, { variant: "subtitle1", children: "Average material occupancy of rotary tables and stocker positions over time" }), _jsx(Box, { flexGrow: 1 }), _jsx("span", { style: { fontSize: "small", marginRight: "1em" }, children: "Moving Average Window: " }), _jsx(SliderAny, { style: { width: "10em" }, min: 1, max: 36, steps: 0.2, valueLabelDisplay: "off", value: movingAverageHours, onChange: (e, v) => setMovingAverage(v) })] }), _jsx("main", { children: _jsx(BufferChart, { movingAverageDistanceInHours: movingAverageHours }) })] }));
|
|
139
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* Copyright (c) 2021, John Lenz
|
|
3
|
+
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
* Redistributions of source code must retain the above copyright
|
|
10
|
+
notice, this list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
* Redistributions in binary form must reproduce the above
|
|
13
|
+
copyright notice, this list of conditions and the following
|
|
14
|
+
disclaimer in the documentation and/or other materials provided
|
|
15
|
+
with the distribution.
|
|
16
|
+
|
|
17
|
+
* Neither the name of John Lenz, Black Maple Software, SeedTactics,
|
|
18
|
+
nor the names of other contributors may be used to endorse or
|
|
19
|
+
promote products derived from this software without specific
|
|
20
|
+
prior written permission.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
23
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
24
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
25
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
26
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
27
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
28
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
29
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
30
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
31
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
32
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
33
|
+
*/
|
|
34
|
+
import { useState, memo } from "react";
|
|
35
|
+
import { Box, Stack } from "@mui/material";
|
|
36
|
+
import { Table } from "@mui/material";
|
|
37
|
+
import { TableBody } from "@mui/material";
|
|
38
|
+
import { TableCell } from "@mui/material";
|
|
39
|
+
import { TableHead } from "@mui/material";
|
|
40
|
+
import { TableRow } from "@mui/material";
|
|
41
|
+
import { TextField } from "@mui/material";
|
|
42
|
+
import { ImportExport } from "@mui/icons-material";
|
|
43
|
+
import { selectedAnalysisPeriod } from "../../network/load-specific-month.js";
|
|
44
|
+
import { LazySeq } from "@seedtactics/immutable-collections";
|
|
45
|
+
import { copyCostPerPieceToClipboard, copyCostBreakdownToClipboard, compute_monthly_cost_percentages, convert_cost_percent_to_cost_per_piece, } from "../../data/cost-per-piece.js";
|
|
46
|
+
import { startOfToday, addDays } from "date-fns";
|
|
47
|
+
import { Tooltip } from "@mui/material";
|
|
48
|
+
import { IconButton } from "@mui/material";
|
|
49
|
+
import { PartIdenticon } from "../station-monitor/Material.js";
|
|
50
|
+
import { Typography } from "@mui/material";
|
|
51
|
+
import { last30MaterialSummary, specificMonthMaterialSummary } from "../../cell-status/material-summary.js";
|
|
52
|
+
import { last30StationCycles, specificMonthStationCycles } from "../../cell-status/station-cycles.js";
|
|
53
|
+
import { useSetTitle } from "../routes.js";
|
|
54
|
+
import { atom, useAtom, useAtomValue } from "jotai";
|
|
55
|
+
import { atomWithStorage } from "jotai/utils";
|
|
56
|
+
import { last30Jobs, specificMonthJobs } from "../../cell-status/scheduled-jobs.js";
|
|
57
|
+
import { durationToSeconds } from "../../util/parseISODuration.js";
|
|
58
|
+
import { atomFamily } from "jotai-family";
|
|
59
|
+
const machineCostPerYear = atomWithStorage("MachineCostPerYear", {});
|
|
60
|
+
const automationCostPerYear = atomWithStorage("AutomationCostPerYear", null);
|
|
61
|
+
const last30LaborCost = atomWithStorage("Last30LaborCost", null);
|
|
62
|
+
const perMonthLaborCost = atomFamily((month) => atomWithStorage("PerMonthLabor-" + month.getFullYear().toString() + "-" + month.getMonth().toString(), null));
|
|
63
|
+
const artifactParts = atom((get) => {
|
|
64
|
+
const period = get(selectedAnalysisPeriod);
|
|
65
|
+
const jobs = get(period.type === "Last30" ? last30Jobs : specificMonthJobs);
|
|
66
|
+
return jobs
|
|
67
|
+
.valuesToLazySeq()
|
|
68
|
+
.filter((j) => j.procsAndPaths.length === 1 &&
|
|
69
|
+
j.procsAndPaths[0].paths.length === 1 &&
|
|
70
|
+
j.procsAndPaths[0].paths[0].stops.length === 1 &&
|
|
71
|
+
durationToSeconds(j.procsAndPaths[0].paths[0].stops[0].expectedCycleTime) === 0)
|
|
72
|
+
.toHashSet((j) => j.partName);
|
|
73
|
+
});
|
|
74
|
+
const costPercentages = atom((get) => {
|
|
75
|
+
const period = get(selectedAnalysisPeriod);
|
|
76
|
+
const cycles = get(period.type === "Last30" ? last30StationCycles : specificMonthStationCycles);
|
|
77
|
+
const matIds = get(period.type === "Last30" ? last30MaterialSummary : specificMonthMaterialSummary);
|
|
78
|
+
const artifacts = get(artifactParts);
|
|
79
|
+
const thirtyDaysAgo = addDays(startOfToday(), -30);
|
|
80
|
+
const month = period.type === "Last30" ? null : period.month;
|
|
81
|
+
return compute_monthly_cost_percentages(cycles.valuesToLazySeq(), artifacts, matIds.matsById, month ? { month: month } : { thirtyDaysAgo });
|
|
82
|
+
});
|
|
83
|
+
const computedCosts = atom((get) => {
|
|
84
|
+
const period = get(selectedAnalysisPeriod);
|
|
85
|
+
const machineCosts = get(machineCostPerYear);
|
|
86
|
+
const automationCosts = get(automationCostPerYear);
|
|
87
|
+
const laborCosts = get(period.type === "Last30" ? last30LaborCost : perMonthLaborCost(period.month));
|
|
88
|
+
const costPcts = get(costPercentages);
|
|
89
|
+
return convert_cost_percent_to_cost_per_piece(costPcts, machineCosts, automationCosts, laborCosts ?? 0);
|
|
90
|
+
});
|
|
91
|
+
function AutomationCostInput() {
|
|
92
|
+
const [cost, setCost] = useState(null);
|
|
93
|
+
const [automationCost, saveAutomationCostPerYear] = useAtom(automationCostPerYear);
|
|
94
|
+
return (_jsx(TextField, { id: "auotmation-cost-year", type: "number", label: "Cost for automated handling system per year", style: { marginTop: "1.5em" }, inputProps: { min: 0 }, variant: "outlined", value: cost === null ? (automationCost ?? "") : isNaN(cost) ? "" : cost, onChange: (e) => setCost(parseFloat(e.target.value)), onBlur: () => {
|
|
95
|
+
if (cost != null) {
|
|
96
|
+
const newCost = isNaN(cost) ? null : cost;
|
|
97
|
+
saveAutomationCostPerYear(newCost);
|
|
98
|
+
}
|
|
99
|
+
setCost(null);
|
|
100
|
+
} }));
|
|
101
|
+
}
|
|
102
|
+
function LaborCost() {
|
|
103
|
+
const period = useAtomValue(selectedAnalysisPeriod);
|
|
104
|
+
const month = period.type === "Last30" ? null : period.month;
|
|
105
|
+
const [cost, setCost] = useState(null);
|
|
106
|
+
const [laborCost, saveCost] = useAtom(month === null ? last30LaborCost : perMonthLaborCost(month));
|
|
107
|
+
return (_jsx(TextField, { type: "number", label: "Total labor cost for " +
|
|
108
|
+
(month === null
|
|
109
|
+
? "last 30 days"
|
|
110
|
+
: month.toLocaleDateString(undefined, { month: "long", year: "numeric" })), inputProps: { min: 0 }, variant: "outlined", value: cost === null ? (laborCost ?? "") : isNaN(cost) ? "" : cost, onChange: (e) => setCost(parseFloat(e.target.value)), onBlur: () => {
|
|
111
|
+
if (cost != null) {
|
|
112
|
+
const newCost = isNaN(cost) ? null : cost;
|
|
113
|
+
saveCost(newCost);
|
|
114
|
+
}
|
|
115
|
+
setCost(null);
|
|
116
|
+
} }));
|
|
117
|
+
}
|
|
118
|
+
function SingleStationCostInput(props) {
|
|
119
|
+
const [cost, setCost] = useState(null);
|
|
120
|
+
const [machineCost, saveCost] = useAtom(machineCostPerYear);
|
|
121
|
+
return (_jsx(TextField, { type: "number", inputProps: { min: 0 }, variant: "outlined", label: "Cost for " + props.machineGroup + " per station per year", style: { marginTop: "1.5em" }, value: cost === null ? (machineCost[props.machineGroup] ?? "") : isNaN(cost) ? "" : cost, onChange: (e) => setCost(parseFloat(e.target.value)), onBlur: () => {
|
|
122
|
+
if (cost != null) {
|
|
123
|
+
const newCost = { ...machineCost };
|
|
124
|
+
if (isNaN(cost)) {
|
|
125
|
+
delete newCost[props.machineGroup];
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
newCost[props.machineGroup] = cost;
|
|
129
|
+
}
|
|
130
|
+
saveCost(newCost);
|
|
131
|
+
}
|
|
132
|
+
setCost(null);
|
|
133
|
+
} }));
|
|
134
|
+
}
|
|
135
|
+
function StationCostInputs() {
|
|
136
|
+
const costs = useAtomValue(computedCosts);
|
|
137
|
+
return (_jsx(_Fragment, { children: costs.machineQuantities.keysToAscLazySeq().map((s, idx) => (_jsx(SingleStationCostInput, { machineQuantities: costs.machineQuantities, machineGroup: s }, idx))) }));
|
|
138
|
+
}
|
|
139
|
+
const decimalFormat = Intl.NumberFormat(undefined, {
|
|
140
|
+
minimumFractionDigits: 1,
|
|
141
|
+
maximumFractionDigits: 1,
|
|
142
|
+
});
|
|
143
|
+
const pctFormat = new Intl.NumberFormat(undefined, {
|
|
144
|
+
style: "percent",
|
|
145
|
+
minimumFractionDigits: 1,
|
|
146
|
+
maximumFractionDigits: 1,
|
|
147
|
+
});
|
|
148
|
+
export function CostBreakdownPage() {
|
|
149
|
+
useSetTitle("Cost Percentages");
|
|
150
|
+
const costs = useAtomValue(costPercentages);
|
|
151
|
+
return (_jsxs(Box, { paddingLeft: "24px", paddingRight: "24px", paddingTop: "10px", children: [_jsxs(Box, { component: "nav", sx: {
|
|
152
|
+
display: "flex",
|
|
153
|
+
minHeight: "2.5em",
|
|
154
|
+
alignItems: "center",
|
|
155
|
+
maxWidth: "calc(100vw - 24px - 24px)",
|
|
156
|
+
}, children: [_jsx(Typography, { variant: "subtitle1", children: "Part Cost Percentage Breakdown" }), _jsx(Box, { flexGrow: 1 }), _jsx(Tooltip, { title: "Copy to Clipboard", children: _jsx(IconButton, { style: { height: "25px", paddingTop: 0, paddingBottom: 0 }, onClick: () => copyCostBreakdownToClipboard(costs), size: "large", children: _jsx(ImportExport, {}) }) })] }), _jsx("main", { children: _jsxs(Table, { stickyHeader: true, children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [_jsx(TableCell, { children: "Part" }), _jsx(TableCell, { align: "right", children: "Completed Quantity" }), costs.machineQuantities.keysToAscLazySeq().map((m) => (_jsxs(TableCell, { align: "right", children: [m, " Cost %"] }, m))), _jsx(TableCell, { align: "right", children: "Labor Cost %" }), _jsx(TableCell, { align: "right", children: "Automation Cost %" })] }) }), _jsx(TableBody, { children: LazySeq.of(costs.parts)
|
|
157
|
+
.sortBy((c) => c.part)
|
|
158
|
+
.map((c, idx) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: _jsxs(Box, { sx: {
|
|
159
|
+
display: "flex",
|
|
160
|
+
alignItems: "center",
|
|
161
|
+
}, children: [_jsx(Box, { sx: { mr: "0.2em" }, children: _jsx(PartIdenticon, { part: c.part, size: 25 }) }), _jsx("div", { children: _jsx(Typography, { variant: "body2", component: "span", display: "block", children: c.part }) })] }) }), _jsx(TableCell, { align: "right", children: c.parts_completed }), costs.machineQuantities.keysToAscLazySeq().map((m) => (_jsx(TableCell, { align: "right", children: pctFormat.format(c.machine.get(m) ?? 0) }, m))), _jsx(TableCell, { align: "right", children: pctFormat.format(c.labor) }), _jsx(TableCell, { align: "right", children: pctFormat.format(c.automation) })] }, idx))) })] }) })] }));
|
|
162
|
+
}
|
|
163
|
+
function CostOutputCard() {
|
|
164
|
+
const costs = useAtomValue(computedCosts);
|
|
165
|
+
return (_jsxs(Table, { stickyHeader: true, children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [_jsx(TableCell, { children: "Part" }), _jsx(TableCell, { align: "right", children: "Completed Quantity" }), costs.machineQuantities.keysToAscLazySeq().map((m) => (_jsxs(TableCell, { align: "right", children: [m, " Cost"] }, m))), _jsx(TableCell, { align: "right", children: "Labor Cost" }), _jsx(TableCell, { align: "right", children: "Automation Cost" }), _jsxs(TableCell, { align: "right", children: [_jsx("span", { children: "Total" }), _jsx(Tooltip, { title: "Copy to Clipboard", children: _jsx(IconButton, { style: { height: "25px", paddingTop: 0, paddingBottom: 0 }, onClick: () => copyCostPerPieceToClipboard(costs), size: "large", children: _jsx(ImportExport, {}) }) })] })] }) }), _jsx(TableBody, { children: LazySeq.of(costs.parts)
|
|
166
|
+
.sortBy((c) => c.part)
|
|
167
|
+
.map((c, idx) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: _jsxs(Box, { sx: {
|
|
168
|
+
display: "flex",
|
|
169
|
+
alignItems: "center",
|
|
170
|
+
}, children: [_jsx(Box, { sx: { mr: "0.2em" }, children: _jsx(PartIdenticon, { part: c.part, size: 25 }) }), _jsx("div", { children: _jsx(Typography, { variant: "body2", component: "span", display: "block", children: c.part }) })] }) }), _jsx(TableCell, { align: "right", children: c.parts_completed }), costs.machineQuantities.keysToAscLazySeq().map((m) => (_jsx(TableCell, { align: "right", children: decimalFormat.format(c.machine.get(m) ?? 0) }, m))), _jsx(TableCell, { align: "right", children: decimalFormat.format(c.labor) }), _jsx(TableCell, { align: "right", children: decimalFormat.format(c.automation) }), _jsx(TableCell, { align: "right", children: decimalFormat.format(c.machine.valuesToAscLazySeq().sumBy((x) => x) + c.labor + c.automation) })] }, idx))) })] }));
|
|
171
|
+
}
|
|
172
|
+
export const CostPerPiecePage = memo(function CostPerPiecePage() {
|
|
173
|
+
useSetTitle("Cost Per Piece");
|
|
174
|
+
return (_jsx(Box, { component: "main", paddingLeft: "24px", paddingRight: "24px", paddingTop: "20px", children: _jsxs(Stack, { direction: "column", spacing: 4, children: [_jsxs(Stack, { direction: "column", spacing: 2, children: [_jsx(LaborCost, {}), _jsx(AutomationCostInput, {}), _jsx(StationCostInputs, {})] }), _jsx(CostOutputCard, {})] }) }));
|
|
175
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { SetStateAction } from "react";
|
|
2
|
+
import { StatisticalCycleTime } from "../../cell-status/estimated-cycle-times.js";
|
|
3
|
+
export interface CycleChartPoint {
|
|
4
|
+
readonly cntr: number;
|
|
5
|
+
readonly x: Date;
|
|
6
|
+
readonly y: number;
|
|
7
|
+
}
|
|
8
|
+
export interface ExtraTooltip {
|
|
9
|
+
title: string;
|
|
10
|
+
value: string;
|
|
11
|
+
link?: () => void;
|
|
12
|
+
}
|
|
13
|
+
export interface DataToPlotProps {
|
|
14
|
+
readonly points: ReadonlyMap<string, ReadonlyArray<CycleChartPoint>>;
|
|
15
|
+
readonly stats?: StatisticalCycleTime;
|
|
16
|
+
readonly partCntPerPoint?: number;
|
|
17
|
+
readonly plannedTimeMinutes?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface ScaleZoomProps {
|
|
20
|
+
readonly default_date_range: Date[];
|
|
21
|
+
readonly current_date_zoom: {
|
|
22
|
+
start: Date;
|
|
23
|
+
end: Date;
|
|
24
|
+
} | undefined;
|
|
25
|
+
readonly set_date_zoom_range: ((p: {
|
|
26
|
+
zoom?: {
|
|
27
|
+
start: Date;
|
|
28
|
+
end: Date;
|
|
29
|
+
};
|
|
30
|
+
}) => void) | undefined;
|
|
31
|
+
readonly yZoom: YZoomRange | null;
|
|
32
|
+
readonly setYZoom: (a: SetStateAction<YZoomRange | null>) => void;
|
|
33
|
+
}
|
|
34
|
+
export type CycleChartProps = DataToPlotProps & ScaleZoomProps & {
|
|
35
|
+
readonly series_label: string;
|
|
36
|
+
readonly extra_tooltip?: (point: CycleChartPoint) => ReadonlyArray<ExtraTooltip>;
|
|
37
|
+
};
|
|
38
|
+
export interface YZoomRange {
|
|
39
|
+
readonly y_low: number;
|
|
40
|
+
readonly y_high: number;
|
|
41
|
+
}
|
|
42
|
+
export declare const CycleChart: import("react").NamedExoticComponent<CycleChartProps>;
|