@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,489 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/* Copyright (c) 2022, 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 { PureComponent, forwardRef, memo, useState, Suspense, } from "react";
|
|
35
|
+
import * as jdenticon from "jdenticon";
|
|
36
|
+
import { Typography, Badge, Box, ButtonBase, Button, Tooltip, Avatar, Paper, CircularProgress, TextField, Dialog, DialogActions, DialogContent, DialogTitle, keyframes, styled, } from "@mui/material";
|
|
37
|
+
import TimeAgo from "react-timeago";
|
|
38
|
+
import { DragIndicator, Warning as WarningIcon, Search as SearchIcon } from "@mui/icons-material";
|
|
39
|
+
import { useSortable } from "@dnd-kit/sortable";
|
|
40
|
+
import * as api from "../../network/api.js";
|
|
41
|
+
import * as matDetails from "../../cell-status/material-details.js";
|
|
42
|
+
import { LogEntries } from "../LogEntry.js";
|
|
43
|
+
import { inproc_mat_to_summary, } from "../../cell-status/material-summary.js";
|
|
44
|
+
import { currentOperator } from "../../data/operators.js";
|
|
45
|
+
import { DisplayLoadingAndError } from "../ErrorsAndLoading.js";
|
|
46
|
+
import { ErrorBoundary } from "react-error-boundary";
|
|
47
|
+
import { currentStatus } from "../../cell-status/current-status.js";
|
|
48
|
+
import { useAtom, useAtomValue, useSetAtom } from "jotai";
|
|
49
|
+
import { loadable } from "jotai/utils";
|
|
50
|
+
import { last30Rebookings } from "../../cell-status/rebookings.js";
|
|
51
|
+
export class PartIdenticon extends PureComponent {
|
|
52
|
+
render() {
|
|
53
|
+
const iconSize = this.props.size || 50;
|
|
54
|
+
const icon = jdenticon.toSvg(this.props.part, iconSize);
|
|
55
|
+
return _jsx("div", { style: { width: iconSize, height: iconSize }, dangerouslySetInnerHTML: { __html: icon } });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const shakeSize = 2;
|
|
59
|
+
const shakeHorizKeyframes = keyframes `
|
|
60
|
+
from, to { transform: translate(0, 0) }
|
|
61
|
+
10% { transform: translate(${shakeSize}px, 0) }
|
|
62
|
+
20% { transform: translate(0, 0) }
|
|
63
|
+
30% { transform: translate(${shakeSize}px, 0) }
|
|
64
|
+
40% { transform: translate(0, 0) }
|
|
65
|
+
50% { transform: translate(${shakeSize}px, 0) }
|
|
66
|
+
60% { transform: translate(0, 0) }
|
|
67
|
+
`;
|
|
68
|
+
const shakeHorizAnimation = `${shakeHorizKeyframes} 1s ease-in-out infinite`;
|
|
69
|
+
// global sync of all shake animations
|
|
70
|
+
// the start time can drift due to the pause on hover, so to keep it in sync always
|
|
71
|
+
// round the start time down to be a multiple of the duration (1s)
|
|
72
|
+
function shakeAnimationIteration(event) {
|
|
73
|
+
const anim = event.currentTarget
|
|
74
|
+
.getAnimations()
|
|
75
|
+
.find((a) => a.animationName === shakeHorizKeyframes.name);
|
|
76
|
+
if (anim && typeof anim.startTime === "number") {
|
|
77
|
+
anim.startTime = anim.startTime - (anim.startTime % 1000);
|
|
78
|
+
}
|
|
79
|
+
else if (anim && typeof anim.startTime === "object" && anim.startTime instanceof CSSNumericValue) {
|
|
80
|
+
const msecs = anim.startTime.to("ms").value;
|
|
81
|
+
anim.startTime = CSS.ms(msecs - (msecs % 1000));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const MatCardHeader = styled("div", { shouldForwardProp: (prop) => prop !== "fsize" })(({ fsize, theme }) => {
|
|
85
|
+
if (!fsize)
|
|
86
|
+
return { fontSize: "1.25rem" };
|
|
87
|
+
switch (fsize) {
|
|
88
|
+
case "normal":
|
|
89
|
+
return { fontSize: "1.5rem" };
|
|
90
|
+
case "large":
|
|
91
|
+
return {
|
|
92
|
+
fontSize: "1.5rem",
|
|
93
|
+
[theme.breakpoints.up("lg")]: {
|
|
94
|
+
fontSize: "1.75rem",
|
|
95
|
+
},
|
|
96
|
+
[theme.breakpoints.up("xl")]: {
|
|
97
|
+
fontSize: "2rem",
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
case "x-large":
|
|
101
|
+
return {
|
|
102
|
+
fontSize: "1.5rem",
|
|
103
|
+
[theme.breakpoints.up("md")]: {
|
|
104
|
+
fontSize: "1.75rem",
|
|
105
|
+
},
|
|
106
|
+
[theme.breakpoints.up("lg")]: {
|
|
107
|
+
fontSize: "2.75rem",
|
|
108
|
+
},
|
|
109
|
+
[theme.breakpoints.up("xl")]: {
|
|
110
|
+
fontSize: "3.75rem",
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
const MatCardDetail = styled("div", { shouldForwardProp: (prop) => prop !== "fsize" })(({ fsize, theme }) => {
|
|
116
|
+
if (!fsize)
|
|
117
|
+
return { fontSize: "0.75rem" };
|
|
118
|
+
switch (fsize) {
|
|
119
|
+
case "normal":
|
|
120
|
+
return { fontSize: "1rem" };
|
|
121
|
+
case "large":
|
|
122
|
+
return {
|
|
123
|
+
fontSize: "1rem",
|
|
124
|
+
[theme.breakpoints.up("lg")]: {
|
|
125
|
+
fontSize: "1.5rem",
|
|
126
|
+
},
|
|
127
|
+
[theme.breakpoints.up("xl")]: {
|
|
128
|
+
fontSize: "1.75rem",
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
case "x-large":
|
|
132
|
+
return {
|
|
133
|
+
fontSize: "1rem",
|
|
134
|
+
[theme.breakpoints.up("md")]: {
|
|
135
|
+
fontSize: "1.5rem",
|
|
136
|
+
},
|
|
137
|
+
[theme.breakpoints.up("lg")]: {
|
|
138
|
+
fontSize: "2.5rem",
|
|
139
|
+
},
|
|
140
|
+
[theme.breakpoints.up("xl")]: {
|
|
141
|
+
fontSize: "3.5rem",
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
export function MaterialAction({ mat, displayActionForSinglePallet, fsize, }) {
|
|
147
|
+
const curSt = useAtomValue(currentStatus);
|
|
148
|
+
switch (mat.action.type) {
|
|
149
|
+
case api.ActionType.Loading:
|
|
150
|
+
switch (mat.location.type) {
|
|
151
|
+
case api.LocType.OnPallet:
|
|
152
|
+
if (displayActionForSinglePallet === undefined ||
|
|
153
|
+
displayActionForSinglePallet === mat.location.palletNum) {
|
|
154
|
+
if (mat.action.loadOntoFace === undefined || mat.action.loadOntoFace === mat.location.face) {
|
|
155
|
+
// material is not moving, just having some manual work done on it
|
|
156
|
+
if (mat.action.processAfterLoad && mat.action.processAfterLoad !== mat.process) {
|
|
157
|
+
return (_jsxs(MatCardDetail, { fsize: fsize, children: ["Reclamp material to process # ", mat.action.processAfterLoad] }));
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
const faceNum = mat.action.loadOntoFace ?? 0;
|
|
165
|
+
const faceName = mat.location.palletNum
|
|
166
|
+
? curSt.pallets[mat.location.palletNum]?.faceNames?.[faceNum - 1]
|
|
167
|
+
: null;
|
|
168
|
+
return _jsxs(MatCardDetail, { fsize: fsize, children: ["Transfer to ", faceName ?? `face ${faceNum}`] });
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
default: {
|
|
175
|
+
const faceNum = mat.action.loadOntoFace ?? 0;
|
|
176
|
+
const faceName = mat.action.loadOntoPalletNum
|
|
177
|
+
? curSt.pallets[mat.action.loadOntoPalletNum]?.faceNames?.[faceNum - 1]
|
|
178
|
+
: null;
|
|
179
|
+
if (displayActionForSinglePallet === undefined) {
|
|
180
|
+
return (_jsxs(MatCardDetail, { fsize: fsize, children: ["Load to ", faceName ?? `face ${faceNum}`, " of pal ", mat.action.loadOntoPalletNum ?? ""] }));
|
|
181
|
+
}
|
|
182
|
+
else if (displayActionForSinglePallet === mat.action.loadOntoPalletNum) {
|
|
183
|
+
return _jsxs(MatCardDetail, { fsize: fsize, children: ["Load to ", faceName ?? `face ${faceNum}`] });
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
case api.ActionType.UnloadToInProcess:
|
|
191
|
+
case api.ActionType.UnloadToCompletedMaterial:
|
|
192
|
+
if (mat.action.unloadIntoQueue) {
|
|
193
|
+
return _jsxs(MatCardDetail, { fsize: fsize, children: ["Unload into queue ", mat.action.unloadIntoQueue] });
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
return _jsx(MatCardDetail, { fsize: fsize, children: "Unload from pallet" });
|
|
197
|
+
}
|
|
198
|
+
case api.ActionType.Waiting:
|
|
199
|
+
if (mat.location.type === api.LocType.InQueue && !!mat.jobUnique && mat.jobUnique !== "") {
|
|
200
|
+
return _jsxs(MatCardDetail, { fsize: fsize, children: ["Waiting; next process is #", mat.process + 1] });
|
|
201
|
+
}
|
|
202
|
+
else if (mat.location.type === api.LocType.OnPallet &&
|
|
203
|
+
(mat.lastCompletedMachiningRouteStopIndex === null ||
|
|
204
|
+
mat.lastCompletedMachiningRouteStopIndex === undefined)) {
|
|
205
|
+
return _jsx(MatCardDetail, { fsize: fsize, children: "Waiting for machining" });
|
|
206
|
+
}
|
|
207
|
+
break;
|
|
208
|
+
case api.ActionType.Machining:
|
|
209
|
+
return _jsxs(MatCardDetail, { fsize: fsize, children: ["Machining program ", mat.action.program ?? ""] });
|
|
210
|
+
}
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
function Warning({ mat }) {
|
|
214
|
+
let tooltip = null;
|
|
215
|
+
if (mat.signaledInspections.length > 0) {
|
|
216
|
+
tooltip = "Inspect: " + mat.signaledInspections.join(", ");
|
|
217
|
+
}
|
|
218
|
+
if (mat.quarantineAfterUnload) {
|
|
219
|
+
if (tooltip === null) {
|
|
220
|
+
tooltip = "Material will quarantine after unload";
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
tooltip += "; Material will quarantine after unload";
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
if (tooltip === null) {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
return (_jsx(Tooltip, { title: tooltip, children: _jsx(WarningIcon, {}) }));
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function JobRawMaterial({ fsize, mat }) {
|
|
234
|
+
const job = useAtomValue(currentStatus).jobs[mat.jobUnique];
|
|
235
|
+
let path = mat.path;
|
|
236
|
+
if (mat.action.type === api.ActionType.Loading && mat.action.pathAfterLoad) {
|
|
237
|
+
path = mat.action.pathAfterLoad;
|
|
238
|
+
}
|
|
239
|
+
if (!job) {
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
const pathData = job.procsAndPaths?.[0]?.paths?.[path - 1];
|
|
243
|
+
if (pathData && pathData.casting && pathData.casting !== "") {
|
|
244
|
+
return _jsx(MatCardDetail, { fsize: fsize, children: pathData.casting });
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
function RebookingNoteElipsis({ fsize, uniq }) {
|
|
251
|
+
const job = useAtomValue(currentStatus).jobs[uniq];
|
|
252
|
+
const rebookings = useAtomValue(last30Rebookings);
|
|
253
|
+
if (job && job.bookings && job.bookings.length > 0) {
|
|
254
|
+
const b = rebookings.get(job.bookings[0]);
|
|
255
|
+
if (b && b.notes && b.notes !== "") {
|
|
256
|
+
return (_jsx(MatCardDetail, { fsize: fsize, style: { textOverflow: "ellipsis", overflow: "hidden", whiteSpace: "nowrap", maxWidth: "10em" }, children: b.notes }));
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
export function WorkorderFromBarcode() {
|
|
262
|
+
const currentSt = useAtomValue(currentStatus);
|
|
263
|
+
const workorderId = useAtomValue(matDetails.workorderInMaterialDialog);
|
|
264
|
+
if (!workorderId)
|
|
265
|
+
return null;
|
|
266
|
+
const comments = currentSt.workorders?.find((w) => w.workorderId === workorderId)?.comments ?? [];
|
|
267
|
+
return (_jsxs("div", { style: { marginTop: "1em", marginLeft: "1em" }, children: [_jsxs("p", { children: ["Workorder: ", workorderId] }), _jsx("ul", { children: comments.map((c, idx) => (_jsx("li", { children: c.comment }, idx))) })] }));
|
|
268
|
+
}
|
|
269
|
+
const MatCard = forwardRef(function MatCard(props, ref) {
|
|
270
|
+
const setMatToShow = useSetAtom(matDetails.materialDialogOpen);
|
|
271
|
+
const completed = props.mat.completedInspections || {};
|
|
272
|
+
let completedMsg;
|
|
273
|
+
if (props.focusInspectionType && completed[props.focusInspectionType]) {
|
|
274
|
+
completedMsg = (_jsxs(MatCardDetail, { fsize: props.fsize, children: [_jsx("span", { children: "Inspection completed " }), _jsx(TimeAgo, { date: completed[props.focusInspectionType].time })] }));
|
|
275
|
+
}
|
|
276
|
+
else if (props.focusInspectionType && props.mat.last_unload_time) {
|
|
277
|
+
completedMsg = (_jsxs(MatCardDetail, { fsize: props.fsize, children: [_jsx("span", { children: "Unloaded " }), _jsx(TimeAgo, { date: props.mat.last_unload_time })] }));
|
|
278
|
+
}
|
|
279
|
+
else if (props.mat.closeout_completed) {
|
|
280
|
+
completedMsg = (_jsxs(MatCardDetail, { fsize: props.fsize, children: [_jsxs("span", { children: [props.mat.closeout_failed ? "Failed " : "", "Closed Out "] }), _jsx(TimeAgo, { date: props.mat.closeout_completed })] }));
|
|
281
|
+
}
|
|
282
|
+
return (_jsxs(Paper, { ref: ref, elevation: 4, sx: {
|
|
283
|
+
display: "flex",
|
|
284
|
+
minWidth: "10em",
|
|
285
|
+
padding: "8px",
|
|
286
|
+
margin: props.isDragOverlay ? undefined : "8px",
|
|
287
|
+
opacity: props.isActiveDrag ? 0.2 : 1,
|
|
288
|
+
animation: props.shake ? shakeHorizAnimation : undefined,
|
|
289
|
+
"&:hover": {
|
|
290
|
+
animationPlayState: "paused",
|
|
291
|
+
},
|
|
292
|
+
}, onAnimationIteration: shakeAnimationIteration, ...props.dragRootProps, children: [props.showDragHandle ? (_jsx("div", { ref: props.setDragHandleRef, role: "button", tabIndex: 0, style: {
|
|
293
|
+
display: "flex",
|
|
294
|
+
flexDirection: "column",
|
|
295
|
+
justifyContent: "center",
|
|
296
|
+
cursor: props.isDragOverlay ? "grabbing" : "grab",
|
|
297
|
+
touchAction: "none",
|
|
298
|
+
}, ...props.dragHandleProps, children: _jsx(DragIndicator, { fontSize: "large", color: "action" }) })) : undefined, _jsx(ButtonBase, { focusRipple: true, sx: { width: "100%" }, onClick: () => setMatToShow(props.inProcMat
|
|
299
|
+
? { type: "InProcMat", inproc: props.inProcMat }
|
|
300
|
+
: { type: "MatSummary", summary: props.mat }), children: _jsxs(Box, { display: "flex", textAlign: "left", alignItems: "center", width: "100%", children: [_jsx(PartIdenticon, { part: props.mat.partName }), _jsxs(Box, { marginLeft: "8px", flexGrow: 1, children: [_jsx(MatCardHeader, { fsize: props.fsize, children: props.mat.partName }), props.displayJob ? (_jsx(MatCardDetail, { fsize: props.fsize, children: props.mat.jobUnique && props.mat.jobUnique !== ""
|
|
301
|
+
? "Assigned to " + props.mat.jobUnique
|
|
302
|
+
: "Unassigned material" })) : undefined, !props.hideEmptySerial || props.mat.serial ? (_jsxs(MatCardDetail, { fsize: props.fsize, children: ["Serial: ", props.mat.serial ? props.mat.serial : "none"] })) : undefined, props.mat.workorderId === undefined ||
|
|
303
|
+
props.mat.workorderId === "" ||
|
|
304
|
+
props.mat.workorderId === props.mat.serial ? undefined : (_jsxs(MatCardDetail, { fsize: props.fsize, children: ["Workorder: ", props.mat.workorderId] })), props.mat.jobUnique !== undefined &&
|
|
305
|
+
props.showRawMaterial &&
|
|
306
|
+
props.inProcMat &&
|
|
307
|
+
props.inProcMat.process === 0 ? (_jsx(JobRawMaterial, { fsize: props.fsize, mat: props.inProcMat })) : undefined, props.showJobComment && props.mat.jobUnique && props.mat.jobUnique !== "" ? (_jsx(RebookingNoteElipsis, { fsize: props.fsize, uniq: props.mat.jobUnique })) : undefined, props.inProcMat ? (_jsx(MaterialAction, { mat: props.inProcMat, displayActionForSinglePallet: props.displayActionForSinglePallet, fsize: props.fsize })) : undefined, completedMsg] }), _jsxs(Box, { marginLeft: "4px", display: "flex", flexDirection: "column", justifyContent: "space-between", alignItems: "flex-end", alignSelf: "start", children: [props.mat.serial && props.mat.serial.length >= 1 && !props.hideAvatar ? (_jsx("div", { children: _jsx(Avatar, { style: { width: "30px", height: "30px" }, children: props.mat.serial.slice(-1) }) })) : undefined, props.hideWarningIcon ? undefined : (_jsx("div", { children: _jsx(Warning, { mat: props.mat }) }))] })] }) })] }));
|
|
308
|
+
});
|
|
309
|
+
export const MatSummary = memo(MatCard);
|
|
310
|
+
export const InProcMaterial = memo(function InProcMaterial(props) {
|
|
311
|
+
return (_jsx(MatCard, { mat: inproc_mat_to_summary(props.mat), inProcMat: props.mat, displayActionForSinglePallet: props.displayActionForSinglePallet, fsize: props.fsize, hideAvatar: props.hideAvatar, displayJob: props.displayJob, showDragHandle: props.showHandle, hideEmptySerial: props.hideEmptySerial, showRawMaterial: props.showRawMaterial, showJobComment: props.showJobComment, shake: props.shake }));
|
|
312
|
+
});
|
|
313
|
+
export const SortableInProcMaterial = memo(function SortableInProcMaterial(props) {
|
|
314
|
+
const d = { mat: props.mat };
|
|
315
|
+
const { active, isDragging, attributes, listeners, setNodeRef, setActivatorNodeRef, transform, transition, } = useSortable({
|
|
316
|
+
id: props.mat.materialID,
|
|
317
|
+
data: d,
|
|
318
|
+
});
|
|
319
|
+
const handleProps = {
|
|
320
|
+
...listeners,
|
|
321
|
+
};
|
|
322
|
+
for (const [a, v] of Object.entries(attributes)) {
|
|
323
|
+
if (a.startsWith("aria")) {
|
|
324
|
+
handleProps[a] = v;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
const style = {
|
|
328
|
+
transform: transform
|
|
329
|
+
? `translate3d(${Math.round(transform.x)}px, ${Math.round(transform.y)}px, 0)`
|
|
330
|
+
: undefined,
|
|
331
|
+
transition: active !== null ? transition : undefined,
|
|
332
|
+
};
|
|
333
|
+
return (_jsx(MatCard, { ref: setNodeRef, dragRootProps: { style }, showDragHandle: true, dragHandleProps: handleProps, setDragHandleRef: setActivatorNodeRef, isActiveDrag: isDragging, mat: inproc_mat_to_summary(props.mat), inProcMat: props.mat, displayActionForSinglePallet: props.displayActionForSinglePallet, hideAvatar: props.hideAvatar, displayJob: props.displayJob, hideEmptySerial: props.hideEmptySerial, fsize: props.fsize, shake: active ? undefined : props.shake, showRawMaterial: props.showRawMaterial }));
|
|
334
|
+
});
|
|
335
|
+
export function DragOverlayInProcMaterial(props) {
|
|
336
|
+
return (_jsx(MatCard, { mat: inproc_mat_to_summary(props.mat), inProcMat: props.mat, displayActionForSinglePallet: props.displayActionForSinglePallet, showDragHandle: true, hideAvatar: props.hideAvatar, displayJob: props.displayJob, fsize: props.fsize, hideEmptySerial: props.hideEmptySerial, isDragOverlay: true }));
|
|
337
|
+
}
|
|
338
|
+
export const MultiMaterial = memo(function MultiMaterial(props) {
|
|
339
|
+
return (_jsx(Paper, { elevation: 4, sx: { display: "flex", minWidth: "10em", padding: "8px", margin: "8px" }, children: _jsx(Badge, { badgeContent: props.material.length < 2 ? 0 : props.material.length, color: "secondary", children: _jsx(ButtonBase, { focusRipple: true, onClick: () => props.onOpen(), children: _jsxs(Box, { display: "flex", textAlign: "left", children: [_jsx(PartIdenticon, { part: props.partOrCasting }), _jsxs(Box, { marginLeft: "8px", flexGrow: 1, children: [_jsx(Typography, { variant: "h6", children: props.partOrCasting }), _jsx(MatCardDetail, { fsize: props.fsize, children: props.assignedJobUnique && props.assignedJobUnique !== ""
|
|
340
|
+
? "Assigned to " + props.assignedJobUnique
|
|
341
|
+
: "Unassigned material" })] }), props.material.length > 0 && props.material[0].serial && props.material[0].serial.length >= 1 ? (_jsx("div", { children: _jsx(Avatar, { style: { width: "30px", height: "30px" }, children: props.material[0].serial.slice(-1) }) })) : undefined] }) }) }) }));
|
|
342
|
+
});
|
|
343
|
+
export const MaterialDetailTitle = memo(function MaterialDetailTitle({ partName, serial, subtitle, notes, }) {
|
|
344
|
+
let title;
|
|
345
|
+
if (partName === "") {
|
|
346
|
+
title = serial ?? "Material";
|
|
347
|
+
}
|
|
348
|
+
else if (serial === undefined || serial === null || serial === "") {
|
|
349
|
+
if (notes) {
|
|
350
|
+
title = "Add note for " + partName;
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
title = partName;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
if (notes) {
|
|
358
|
+
title = "Add note for " + serial;
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
title = partName + " - " + serial;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
return (_jsxs(Box, { display: "flex", textAlign: "left", children: [partName === "" ? _jsx(SearchIcon, {}) : _jsx(PartIdenticon, { part: partName }), _jsxs(Box, { marginLeft: "8px", flexGrow: 1, children: [_jsx(Typography, { variant: "h6", children: title }), subtitle ? _jsx(Typography, { variant: "caption", children: subtitle }) : undefined] })] }));
|
|
365
|
+
});
|
|
366
|
+
function MaterialDialogTitle({ notes }) {
|
|
367
|
+
const matL = useAtomValue(loadable(matDetails.materialInDialogInfo));
|
|
368
|
+
const serialL = useAtomValue(loadable(matDetails.serialInMaterialDialog));
|
|
369
|
+
const mat = matL.state === "hasData" ? matL.data : null;
|
|
370
|
+
const serial = serialL.state === "hasData" ? serialL.data : null;
|
|
371
|
+
return _jsx(MaterialDetailTitle, { notes: notes, partName: mat?.partName ?? "", serial: mat?.serial ?? serial });
|
|
372
|
+
}
|
|
373
|
+
function MaterialInspections() {
|
|
374
|
+
const insps = useAtomValue(matDetails.materialInDialogInspections);
|
|
375
|
+
function colorForInspType(type) {
|
|
376
|
+
if (insps.completedInspections.includes(type)) {
|
|
377
|
+
return "black";
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
return "red";
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
if (insps.signaledInspections.length === 0) {
|
|
384
|
+
return _jsx("small", { children: "Inspections: none" });
|
|
385
|
+
}
|
|
386
|
+
else {
|
|
387
|
+
return (_jsxs("small", { children: ["Inspections:", " ", insps.signaledInspections.map((type, i) => (_jsxs("span", { children: [i === 0 ? "" : ", ", _jsx("span", { style: { color: colorForInspType(type) }, children: type })] }, i)))] }));
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
function MaterialEvents({ highlightProcsGreaterOrEqualTo }) {
|
|
391
|
+
const events = useAtomValue(matDetails.materialInDialogEvents);
|
|
392
|
+
return (_jsx(LogEntries, { entries: events, copyToClipboard: true, highlightProcsGreaterOrEqualTo: highlightProcsGreaterOrEqualTo }));
|
|
393
|
+
}
|
|
394
|
+
function RebookingNote() {
|
|
395
|
+
const mat = useAtomValue(matDetails.inProcessMaterialInDialog);
|
|
396
|
+
const jobs = useAtomValue(currentStatus).jobs;
|
|
397
|
+
const rebookigns = useAtomValue(last30Rebookings);
|
|
398
|
+
const job = mat ? jobs[mat.jobUnique] : null;
|
|
399
|
+
if (job && job.bookings && job.bookings.length > 0) {
|
|
400
|
+
const b = rebookigns.get(job.bookings[0]);
|
|
401
|
+
if (b && b.notes && b.notes !== "") {
|
|
402
|
+
return (_jsx(Typography, { variant: "caption", sx: { width: "100%", textWrap: "wrap" }, children: b.notes }));
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return null;
|
|
406
|
+
}
|
|
407
|
+
export const MaterialDetailContent = memo(function MaterialDetailContent({ highlightProcsGreaterOrEqualTo, }) {
|
|
408
|
+
const toShow = useAtomValue(matDetails.materialDialogOpen);
|
|
409
|
+
const mat = useAtomValue(matDetails.materialInDialogInfo);
|
|
410
|
+
const barcodeNewMat = useAtomValue(matDetails.barcodePotentialNewMaterial);
|
|
411
|
+
if (toShow === null)
|
|
412
|
+
return null;
|
|
413
|
+
if (mat === null) {
|
|
414
|
+
if (toShow.type === "AddMatWithEnteredSerial" || toShow.type === "ManuallyEnteredSerial") {
|
|
415
|
+
return _jsxs("div", { style: { marginLeft: "1em" }, children: ["Material with serial ", toShow.serial, " not found."] });
|
|
416
|
+
}
|
|
417
|
+
else if (toShow.type === "Barcode") {
|
|
418
|
+
if (barcodeNewMat) {
|
|
419
|
+
return (_jsxs("div", { style: { marginLeft: "1em" }, children: ["Material with barcode ", toShow.barcode, " does not yet exist in the cell."] }));
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
return _jsxs("div", { style: { marginLeft: "1em" }, children: ["Material with barcode ", toShow.barcode, " not found."] });
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
else {
|
|
426
|
+
return _jsx("div", { style: { marginLeft: "1em" }, children: "Material not found." });
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { style: { marginLeft: "1em" }, children: [_jsx("div", { children: _jsxs("small", { children: ["Workorder: ", mat?.workorderId ?? "none"] }) }), _jsx("div", { children: _jsx(DisplayLoadingAndError, { fallback: _jsxs("small", { children: ["Inspections: ", _jsx(CircularProgress, { size: "10" })] }), children: _jsx(MaterialInspections, {}) }) }), _jsx("div", { children: _jsx(DisplayLoadingAndError, { fallback: _jsx("div", {}), children: _jsx(RebookingNote, {}) }) })] }), _jsx(DisplayLoadingAndError, { fallback: _jsx(CircularProgress, {}), children: _jsx(MaterialEvents, { highlightProcsGreaterOrEqualTo: highlightProcsGreaterOrEqualTo }) })] }));
|
|
430
|
+
});
|
|
431
|
+
function NotesDialogBody(props) {
|
|
432
|
+
const [curNote, setCurNote] = useState("");
|
|
433
|
+
const operator = useAtomValue(currentOperator);
|
|
434
|
+
const [addNote] = matDetails.useAddNote();
|
|
435
|
+
const mat = useAtomValue(matDetails.materialInDialogInfo);
|
|
436
|
+
if (mat === null)
|
|
437
|
+
return null;
|
|
438
|
+
return (_jsxs(_Fragment, { children: [_jsx(DialogContent, { children: _jsx(TextField, { sx: { mt: "5px" }, multiline: true, label: "Note", autoFocus: true, variant: "outlined", value: curNote, onChange: (e) => setCurNote(e.target.value) }) }), _jsxs(DialogActions, { children: [_jsx(Button, { onClick: () => {
|
|
439
|
+
addNote({ matId: mat.materialID, process: 0, operator: operator, notes: curNote });
|
|
440
|
+
props.setNotesOpen(false);
|
|
441
|
+
setCurNote("");
|
|
442
|
+
}, disabled: curNote === "", color: "secondary", children: "Save" }), _jsx(Button, { onClick: () => {
|
|
443
|
+
props.setNotesOpen(false);
|
|
444
|
+
setCurNote("");
|
|
445
|
+
}, color: "secondary", children: "Cancel" })] })] }));
|
|
446
|
+
}
|
|
447
|
+
export function MaterialLoading() {
|
|
448
|
+
const toShow = useAtomValue(matDetails.materialDialogOpen);
|
|
449
|
+
if (toShow === null)
|
|
450
|
+
return null;
|
|
451
|
+
let msg;
|
|
452
|
+
switch (toShow.type) {
|
|
453
|
+
case "Barcode":
|
|
454
|
+
msg = "Loading material with barcode " + toShow.barcode + "...";
|
|
455
|
+
break;
|
|
456
|
+
case "AddMatWithEnteredSerial":
|
|
457
|
+
case "ManuallyEnteredSerial":
|
|
458
|
+
msg = "Loading material with serial " + toShow.serial + "...";
|
|
459
|
+
break;
|
|
460
|
+
default:
|
|
461
|
+
msg = "Loading material...";
|
|
462
|
+
break;
|
|
463
|
+
}
|
|
464
|
+
return (_jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center" }, children: [_jsx(CircularProgress, {}), _jsx("div", { style: { marginTop: "1em" }, children: msg })] }));
|
|
465
|
+
}
|
|
466
|
+
function AddNoteButton({ setNotesOpen }) {
|
|
467
|
+
const mat = useAtomValue(matDetails.materialInDialogInfo);
|
|
468
|
+
if (mat === null || mat.materialID < 0)
|
|
469
|
+
return null;
|
|
470
|
+
return (_jsx(Button, { onClick: () => setNotesOpen(true), color: "primary", children: "Add Note" }));
|
|
471
|
+
}
|
|
472
|
+
export const MaterialDialog = memo(function MaterialDialog(props) {
|
|
473
|
+
const [notesOpen, setNotesOpen] = useState(false);
|
|
474
|
+
const [dialogOpen, setOpen] = useAtom(matDetails.materialDialogOpen);
|
|
475
|
+
function close() {
|
|
476
|
+
setOpen(null);
|
|
477
|
+
if (props.onClose)
|
|
478
|
+
props.onClose();
|
|
479
|
+
}
|
|
480
|
+
let body;
|
|
481
|
+
let notesBody;
|
|
482
|
+
if (dialogOpen) {
|
|
483
|
+
body = (_jsxs(_Fragment, { children: [_jsx(DialogTitle, { children: _jsx(MaterialDialogTitle, {}) }), _jsx(DialogContent, { children: _jsxs(DisplayLoadingAndError, { fallback: _jsx(MaterialLoading, {}), children: [_jsx(MaterialDetailContent, { highlightProcsGreaterOrEqualTo: props.highlightProcsGreaterOrEqualTo }), _jsx(DisplayLoadingAndError, { fallback: _jsx(CircularProgress, {}), children: props.extraDialogElements })] }) }), _jsxs(DialogActions, { children: [dialogOpen && (props.buttons || props.allowNote) ? (_jsx(ErrorBoundary, { fallback: _jsx("div", {}), children: _jsxs(Suspense, { fallback: _jsx("div", {}), children: [dialogOpen && props.allowNote ? _jsx(AddNoteButton, { setNotesOpen: setNotesOpen }) : undefined, props.buttons] }) })) : null, _jsx(Button, { onClick: close, color: "secondary", children: "Close" })] })] }));
|
|
484
|
+
if (props.allowNote) {
|
|
485
|
+
notesBody = (_jsxs(_Fragment, { children: [_jsx(DialogTitle, { children: _jsx(MaterialDialogTitle, { notes: true }) }), _jsxs(DisplayLoadingAndError, { fallback: _jsx(DialogContent, { children: _jsx(CircularProgress, {}) }), children: [_jsx(NotesDialogBody, { setNotesOpen: setNotesOpen }), ";"] })] }));
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
return (_jsxs(_Fragment, { children: [_jsx(Dialog, { open: dialogOpen !== null, onClose: close, maxWidth: "lg", children: body }), props.allowNote ? (_jsx(Dialog, { open: notesOpen, onClose: () => setNotesOpen(false), maxWidth: "md", children: notesBody })) : undefined] }));
|
|
489
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RefObject, ReactNode } from "react";
|
|
2
|
+
import { MoveMaterialNodeKind } from "../../data/move-arrows.js";
|
|
3
|
+
export declare const MoveMaterialArrowContainer: import("react").NamedExoticComponent<{
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
hideArrows?: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
export declare function useMoveMaterialArrowRef(kind: MoveMaterialNodeKind): RefObject<HTMLDivElement | null>;
|
|
8
|
+
export declare function MoveMaterialArrowNode({ kind, children, }: {
|
|
9
|
+
kind: MoveMaterialNodeKind;
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* Copyright (c) 2022, 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, useEffect, createContext, useRef, useMemo, useContext, } from "react";
|
|
35
|
+
import { computeArrows, uniqueIdForNodeKind, memoPropsForNodeKind, } from "../../data/move-arrows.js";
|
|
36
|
+
import { HashMap } from "@seedtactics/immutable-collections";
|
|
37
|
+
function elementToRect(e) {
|
|
38
|
+
const r = e.getBoundingClientRect();
|
|
39
|
+
return {
|
|
40
|
+
left: r.left + window.scrollX,
|
|
41
|
+
top: r.top + window.scrollY,
|
|
42
|
+
width: r.width,
|
|
43
|
+
height: r.height,
|
|
44
|
+
bottom: r.bottom + window.scrollY,
|
|
45
|
+
right: r.right + window.scrollX,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function arrowToPath(arr) {
|
|
49
|
+
// mid point of line
|
|
50
|
+
const mpx = (arr.fromX + arr.toX) / 2;
|
|
51
|
+
const mpy = (arr.fromY + arr.toY) / 2;
|
|
52
|
+
// angle of perpendicular to line
|
|
53
|
+
const theta = Math.atan2(arr.toY - arr.fromY, arr.toX - arr.fromX) + (Math.PI * arr.curveDirection) / 2;
|
|
54
|
+
// control points
|
|
55
|
+
const cx = mpx + 50 * Math.cos(theta);
|
|
56
|
+
const cy = mpy + 50 * Math.sin(theta);
|
|
57
|
+
return `M${arr.fromX},${arr.fromY} Q ${cx} ${cy} ${arr.toX} ${arr.toY}`;
|
|
58
|
+
}
|
|
59
|
+
const MoveMaterialArrows = memo(function MoveMaterialArrows({ container, arrowsWithRefs, }) {
|
|
60
|
+
const [, setDims] = useState({
|
|
61
|
+
height: window.innerHeight,
|
|
62
|
+
width: window.innerWidth,
|
|
63
|
+
});
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
function handleResize() {
|
|
66
|
+
setDims({ height: window.innerHeight, width: window.innerWidth });
|
|
67
|
+
}
|
|
68
|
+
window.addEventListener("resize", handleResize);
|
|
69
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
70
|
+
}, [setDims]);
|
|
71
|
+
const arrows = computeArrows(container.current ? elementToRect(container.current) : null, arrowsWithRefs.collectValues((r) => r.elem.current ? { ...r, elem: elementToRect(r.elem.current) } : null));
|
|
72
|
+
return (_jsx("g", { children: arrows.map((arr, idx) => (_jsx("path", { style: { fill: "none", stroke: "rgba(0,0,0,0.15)", strokeWidth: 2 }, d: arrowToPath(arr), markerEnd: `url(#arrow)` }, idx))) }));
|
|
73
|
+
});
|
|
74
|
+
const MoveMaterialArrowCtx = createContext(undefined);
|
|
75
|
+
export const MoveMaterialArrowContainer = memo(function MoveMaterialArrowContainer({ children, hideArrows, }) {
|
|
76
|
+
const container = useRef(null);
|
|
77
|
+
const [nodes, setNodes] = useState(HashMap.empty());
|
|
78
|
+
const ctx = useMemo(() => {
|
|
79
|
+
return {
|
|
80
|
+
registerNode(id, kind, ref) {
|
|
81
|
+
if (kind && ref) {
|
|
82
|
+
setNodes((ns) => ns.set(id, { ...kind, elem: ref }));
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
setNodes((nodes) => nodes.delete(id));
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}, [setNodes]);
|
|
90
|
+
return (_jsxs("div", { style: { position: "relative" }, children: [_jsxs("svg", { style: {
|
|
91
|
+
position: "absolute",
|
|
92
|
+
pointerEvents: "none",
|
|
93
|
+
width: "100%",
|
|
94
|
+
height: "100%",
|
|
95
|
+
top: 0,
|
|
96
|
+
right: 0,
|
|
97
|
+
}, children: [_jsx("defs", { children: _jsx("marker", { id: "arrow", markerWidth: 6, markerHeight: 10, refX: "0", refY: "3", orient: "auto", markerUnits: "strokeWidth", children: _jsx("path", { d: "M0,0 L0,6 L5,3 z", fill: "rgba(0,0,0,0.15)" }) }) }), !hideArrows ? _jsx(MoveMaterialArrows, { container: container, arrowsWithRefs: nodes }) : undefined] }), _jsx("div", { ref: container, children: _jsx(MoveMaterialArrowCtx.Provider, { value: ctx, children: children }) })] }));
|
|
98
|
+
});
|
|
99
|
+
export function useMoveMaterialArrowRef(kind) {
|
|
100
|
+
const ctx = useContext(MoveMaterialArrowCtx);
|
|
101
|
+
if (!ctx) {
|
|
102
|
+
throw new Error("useMoveMaterialArrowRef must be used within a MoveMaterialArrowContainer");
|
|
103
|
+
}
|
|
104
|
+
const ref = useRef(null);
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
const id = uniqueIdForNodeKind(kind);
|
|
107
|
+
ctx.registerNode(id, kind, ref);
|
|
108
|
+
return () => {
|
|
109
|
+
ctx.registerNode(id, null, null);
|
|
110
|
+
};
|
|
111
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
112
|
+
}, [ctx, ...memoPropsForNodeKind(kind)]);
|
|
113
|
+
return ref;
|
|
114
|
+
}
|
|
115
|
+
export function MoveMaterialArrowNode({ kind, children, }) {
|
|
116
|
+
const ref = useMoveMaterialArrowRef(kind);
|
|
117
|
+
return _jsx("div", { ref: ref, children: children });
|
|
118
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface PrintMaterial {
|
|
2
|
+
readonly partName: string;
|
|
3
|
+
readonly jobUnique: string;
|
|
4
|
+
readonly serial?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PrintedLabelProps {
|
|
7
|
+
readonly material: ReadonlyArray<PrintMaterial> | null;
|
|
8
|
+
readonly materialName?: string | null;
|
|
9
|
+
readonly operator?: string | null;
|
|
10
|
+
readonly oneJobPerPage: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface SinglePageProps {
|
|
13
|
+
readonly partName: string;
|
|
14
|
+
readonly materialName: string | null | undefined;
|
|
15
|
+
readonly count: number;
|
|
16
|
+
readonly uniq: string | null;
|
|
17
|
+
readonly jobCycles?: number | null | undefined;
|
|
18
|
+
readonly note: string | null | undefined;
|
|
19
|
+
readonly operator: string | null | undefined;
|
|
20
|
+
readonly serial1: string | undefined;
|
|
21
|
+
readonly serial2: string | undefined;
|
|
22
|
+
}
|
|
23
|
+
export declare function PrintedLabel(props: PrintedLabelProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare function PrintOnClientButton({ mat, materialName, operator, }: {
|
|
25
|
+
mat: PrintMaterial | ReadonlyArray<PrintMaterial>;
|
|
26
|
+
materialName?: string | null;
|
|
27
|
+
operator?: string | null;
|
|
28
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export declare function PrintLabelButton(): import("react/jsx-runtime").JSX.Element | null;
|