@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,267 @@
|
|
|
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 { forwardRef, memo, PureComponent, useState, useCallback, useMemo, } from "react";
|
|
35
|
+
import { selectAllMaterialIntoBins, MaterialBinType, moveMaterialBin, currentMaterialBinOrder, moveMaterialInBin, findMaterialInQuarantineQueues, findQueueInQuarantineQueues, } from "../../data/all-material-bins.js";
|
|
36
|
+
import * as matDetails from "../../cell-status/material-details.js";
|
|
37
|
+
import * as currentSt from "../../cell-status/current-status.js";
|
|
38
|
+
import { Box } from "@mui/material";
|
|
39
|
+
import { Typography } from "@mui/material";
|
|
40
|
+
import { LazySeq } from "@seedtactics/immutable-collections";
|
|
41
|
+
import { DragOverlayInProcMaterial, InProcMaterial, MaterialDialog, SortableInProcMaterial, } from "../station-monitor/Material.js";
|
|
42
|
+
import { InvalidateCycleDialogButton, InvalidateCycleDialogContent, SwapMaterialButtons, SwapMaterialDialogContent, } from "../station-monitor/InvalidateCycle.js";
|
|
43
|
+
import { horizontalListSortingStrategy, SortableContext, useSortable, verticalListSortingStrategy, } from "@dnd-kit/sortable";
|
|
44
|
+
import { closestCenter, DndContext, DragOverlay, getFirstCollision, MeasuringStrategy, pointerWithin, rectIntersection, } from "@dnd-kit/core";
|
|
45
|
+
import { QuarantineMatButton } from "../station-monitor/QuarantineButton.js";
|
|
46
|
+
import { useSetTitle } from "../routes.js";
|
|
47
|
+
import { useAtom, useAtomValue, useSetAtom } from "jotai";
|
|
48
|
+
const ColumnWithTitle = forwardRef(function MaterialBin(props, ref) {
|
|
49
|
+
return (_jsxs(Box, { sx: {
|
|
50
|
+
margin: props.isDragOverlay ? undefined : "0.75em",
|
|
51
|
+
opacity: props.isActiveDrag ? 0.2 : 1,
|
|
52
|
+
border: "1px solid black",
|
|
53
|
+
padding: "4px",
|
|
54
|
+
}, ref: ref, ...props.dragRootProps, children: [_jsx(Box, { role: "button", tabIndex: 0, sx: { cursor: props.isDragOverlay ? "grabbing" : "grab" }, ...props.dragHandleProps, children: _jsx(Typography, { variant: "h4", children: props.label }) }), _jsx(Box, { sx: {
|
|
55
|
+
display: "flex",
|
|
56
|
+
flexDirection: "column",
|
|
57
|
+
flexWrap: "nowrap",
|
|
58
|
+
width: "18em",
|
|
59
|
+
minHeight: "20em",
|
|
60
|
+
}, children: props.children })] }));
|
|
61
|
+
});
|
|
62
|
+
function SortableColumnWithTitle(props) {
|
|
63
|
+
const data = { type: "container", bin: props.bin };
|
|
64
|
+
const { active, isDragging, attributes, listeners, setNodeRef, setActivatorNodeRef, transform, transition, } = useSortable({
|
|
65
|
+
id: props.binId,
|
|
66
|
+
data,
|
|
67
|
+
});
|
|
68
|
+
const handleProps = {
|
|
69
|
+
...listeners,
|
|
70
|
+
};
|
|
71
|
+
for (const [a, v] of Object.entries(attributes)) {
|
|
72
|
+
if (a.startsWith("aria")) {
|
|
73
|
+
handleProps[a] = v;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const style = {
|
|
77
|
+
transform: transform
|
|
78
|
+
? `translate3d(${Math.round(transform.x)}px, ${Math.round(transform.y)}px, 0)`
|
|
79
|
+
: undefined,
|
|
80
|
+
transition: active !== null ? transition : undefined,
|
|
81
|
+
};
|
|
82
|
+
return (_jsx(ColumnWithTitle, { ref: setNodeRef, dragRootProps: { style }, dragHandleProps: handleProps, setDragHandleRef: setActivatorNodeRef, isActiveDrag: isDragging, ...props }));
|
|
83
|
+
}
|
|
84
|
+
const QuarantineQueue = memo(function QuarantineQueue(props) {
|
|
85
|
+
if (props.isDragOverlay) {
|
|
86
|
+
return (_jsx(ColumnWithTitle, { binId: props.binId, label: props.queue, isDragOverlay: true, children: props.material.map((mat) => (_jsx(InProcMaterial, { mat: mat, hideAvatar: true, showHandle: true }, mat.materialID))) }));
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
return (_jsx(SortableColumnWithTitle, { binId: props.binId, label: props.queue, bin: props.bin, children: _jsx(SortableContext, { items: props.material.map((m) => m.materialID), strategy: verticalListSortingStrategy, children: props.material.map((mat) => (_jsx(SortableInProcMaterial, { mat: mat, hideAvatar: true }, mat.materialID))) }) }));
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
function renderLul(lul) {
|
|
93
|
+
return "L/U " + lul.toString();
|
|
94
|
+
}
|
|
95
|
+
function compareLul(l1, l2) {
|
|
96
|
+
return l1 - l2;
|
|
97
|
+
}
|
|
98
|
+
function renderPal(pal) {
|
|
99
|
+
return "Pallet " + pal;
|
|
100
|
+
}
|
|
101
|
+
function comparePal(p1, p2) {
|
|
102
|
+
const n1 = parseInt(p1);
|
|
103
|
+
const n2 = parseInt(p2);
|
|
104
|
+
if (isNaN(n1) || isNaN(n2)) {
|
|
105
|
+
return p1.localeCompare(p2);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
return n1 - n2;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function renderQueue(queue) {
|
|
112
|
+
return queue;
|
|
113
|
+
}
|
|
114
|
+
function compareQueue(q1, q2) {
|
|
115
|
+
return q1.localeCompare(q2);
|
|
116
|
+
}
|
|
117
|
+
class SystemMaterial extends PureComponent {
|
|
118
|
+
render() {
|
|
119
|
+
const Col = this.props.isDragOverlay ? ColumnWithTitle : SortableColumnWithTitle;
|
|
120
|
+
return (_jsx(Col, { label: this.props.name, binId: this.props.binId, bin: this.props.bin, isDragOverlay: this.props.isDragOverlay, children: LazySeq.of(this.props.material)
|
|
121
|
+
.sortWith(([l1, _m1], [l2, _m2]) => this.props.compareLabel(l1, l2))
|
|
122
|
+
.map(([label, material], idx) => (_jsxs("div", { children: [_jsx(Typography, { variant: "caption", children: this.props.renderLabel(label) }), material.map((mat, idx) => (_jsx(InProcMaterial, { mat: mat, hideAvatar: true }, idx)))] }, idx))) }));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function MaterialBinColumn({ matBin, isDragOverlay, }) {
|
|
126
|
+
switch (matBin.type) {
|
|
127
|
+
case MaterialBinType.LoadStations:
|
|
128
|
+
return (_jsx(SystemMaterial, { name: "Load Stations", binId: matBin.binId, renderLabel: renderLul, compareLabel: compareLul, material: matBin.byLul, bin: matBin, isDragOverlay: isDragOverlay }));
|
|
129
|
+
case MaterialBinType.Pallets:
|
|
130
|
+
return (_jsx(SystemMaterial, { name: "Pallets", binId: matBin.binId, renderLabel: renderPal, compareLabel: comparePal, material: matBin.byPallet, bin: matBin, isDragOverlay: isDragOverlay }));
|
|
131
|
+
case MaterialBinType.ActiveQueues:
|
|
132
|
+
return (_jsx(SystemMaterial, { name: "Queues", binId: matBin.binId, renderLabel: renderQueue, compareLabel: compareQueue, material: matBin.byQueue, bin: matBin, isDragOverlay: isDragOverlay }));
|
|
133
|
+
case MaterialBinType.QuarantineQueues:
|
|
134
|
+
return (_jsx(QuarantineQueue, { binId: matBin.binId, queue: matBin.queueName, material: matBin.material, bin: matBin, isDragOverlay: isDragOverlay }));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const AllMatDialog = memo(function AllMatDialog() {
|
|
138
|
+
const [swapSt, setSwapSt] = useState(null);
|
|
139
|
+
const [invalidateSt, setInvalidateSt] = useState(null);
|
|
140
|
+
function onClose() {
|
|
141
|
+
setSwapSt(null);
|
|
142
|
+
setInvalidateSt(null);
|
|
143
|
+
}
|
|
144
|
+
return (_jsx(MaterialDialog, { onClose: onClose, allowNote: true, highlightProcsGreaterOrEqualTo: invalidateSt?.process ?? undefined, extraDialogElements: _jsxs(_Fragment, { children: [_jsx(SwapMaterialDialogContent, { st: swapSt, setState: setSwapSt }), invalidateSt !== null ? (_jsx(InvalidateCycleDialogContent, { st: invalidateSt, setState: setInvalidateSt })) : null] }), buttons: _jsxs(_Fragment, { children: [_jsx(QuarantineMatButton, { onClose: onClose, ignoreOperator: true }), _jsx(SwapMaterialButtons, { st: swapSt, setState: setSwapSt, onClose: onClose, ignoreOperator: true }), _jsx(InvalidateCycleDialogButton, { st: invalidateSt, setState: setInvalidateSt, onClose: onClose, ignoreOperator: true })] }) }));
|
|
145
|
+
});
|
|
146
|
+
function useCollisionDetection(allBins) {
|
|
147
|
+
return useCallback((args) => {
|
|
148
|
+
if (typeof args.active.id === "string") {
|
|
149
|
+
// columns only collide with other columns
|
|
150
|
+
return closestCenter({
|
|
151
|
+
...args,
|
|
152
|
+
droppableContainers: args.droppableContainers.filter((container) => typeof container.id === "string"),
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
// Intersect the material with any droppable (either another material or a column)
|
|
156
|
+
const pointerIntersections = pointerWithin(args);
|
|
157
|
+
const intersections = pointerIntersections.length > 0 ? pointerIntersections : rectIntersection(args);
|
|
158
|
+
let overId = getFirstCollision(intersections, "id");
|
|
159
|
+
if (overId != null) {
|
|
160
|
+
if (typeof overId === "string") {
|
|
161
|
+
// If the over is a non-empty column, find the closest material inside that column
|
|
162
|
+
const bin = findQueueInQuarantineQueues(overId, allBins);
|
|
163
|
+
if (bin && bin.bin.material.length > 0) {
|
|
164
|
+
overId = closestCenter({
|
|
165
|
+
...args,
|
|
166
|
+
droppableContainers: args.droppableContainers.filter((container) => container.id !== overId &&
|
|
167
|
+
bin.bin.material.findIndex((m) => m.materialID === container.id) >= 0),
|
|
168
|
+
})[0]?.id;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return [{ id: overId }];
|
|
172
|
+
}
|
|
173
|
+
return [];
|
|
174
|
+
}, [allBins]);
|
|
175
|
+
}
|
|
176
|
+
export function AllMaterial(props) {
|
|
177
|
+
useSetTitle("All Material");
|
|
178
|
+
const st = useAtomValue(currentSt.currentStatus);
|
|
179
|
+
const [matBinOrder, setMatBinOrder] = useAtom(currentMaterialBinOrder);
|
|
180
|
+
const [addExistingMatToQueue] = matDetails.useAddExistingMaterialToQueue();
|
|
181
|
+
const reorderQueuedMat = useSetAtom(currentSt.reorderQueuedMatInCurrentStatus);
|
|
182
|
+
const [activeDrag, setActiveDrag] = useState(null);
|
|
183
|
+
const allBins = useMemo(() => {
|
|
184
|
+
const allBins = selectAllMaterialIntoBins(st, matBinOrder);
|
|
185
|
+
if (activeDrag && activeDrag.type === "material" && activeDrag.curOverBinId !== null) {
|
|
186
|
+
return moveMaterialInBin(allBins, activeDrag.mat, activeDrag.curOverBinId, activeDrag.initialIdx);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
return allBins;
|
|
190
|
+
}
|
|
191
|
+
}, [st, matBinOrder, activeDrag]);
|
|
192
|
+
const curBins = props.displaySystemBins
|
|
193
|
+
? allBins
|
|
194
|
+
: allBins.filter((bin) => bin.type === MaterialBinType.QuarantineQueues);
|
|
195
|
+
const collisionDetectionStrategy = useCollisionDetection(allBins);
|
|
196
|
+
return (_jsxs(DndContext, { collisionDetection: collisionDetectionStrategy, measuring: {
|
|
197
|
+
droppable: { strategy: MeasuringStrategy.Always },
|
|
198
|
+
}, onDragStart: ({ active }) => {
|
|
199
|
+
if (typeof active.id === "string") {
|
|
200
|
+
setActiveDrag({ type: "column", bin: active.data.current.bin });
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
setActiveDrag({
|
|
204
|
+
type: "material",
|
|
205
|
+
mat: active.data.current.mat,
|
|
206
|
+
curOverBinId: null,
|
|
207
|
+
initialIdx: 0,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}, onDragOver: ({ over }) => {
|
|
211
|
+
if (!over)
|
|
212
|
+
return;
|
|
213
|
+
if (activeDrag === null || activeDrag.type === "column")
|
|
214
|
+
return;
|
|
215
|
+
const overCol = typeof over.id === "string"
|
|
216
|
+
? findQueueInQuarantineQueues(over.id, allBins)
|
|
217
|
+
: findMaterialInQuarantineQueues(over.id, allBins);
|
|
218
|
+
if (!overCol)
|
|
219
|
+
return;
|
|
220
|
+
if (overCol.bin.binId !== activeDrag.curOverBinId) {
|
|
221
|
+
setActiveDrag({
|
|
222
|
+
...activeDrag,
|
|
223
|
+
curOverBinId: overCol.bin.binId,
|
|
224
|
+
initialIdx: overCol.idx,
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
}, onDragEnd: ({ over }) => {
|
|
228
|
+
if (activeDrag === null)
|
|
229
|
+
return;
|
|
230
|
+
if (!over) {
|
|
231
|
+
setActiveDrag(null);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (activeDrag.type === "column") {
|
|
235
|
+
if (typeof over.id === "number") {
|
|
236
|
+
console.log("Invalid, collision should never allow a column drag to be over a material");
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
setMatBinOrder(moveMaterialBin(curBins.map((b) => b.binId), curBins.findIndex((b) => b.binId === activeDrag.bin.binId), curBins.findIndex((b) => b.binId === over.id)));
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
const overCol = typeof over.id === "string"
|
|
244
|
+
? findQueueInQuarantineQueues(over.id, allBins)
|
|
245
|
+
: findMaterialInQuarantineQueues(over.id, allBins);
|
|
246
|
+
if (overCol) {
|
|
247
|
+
addExistingMatToQueue({
|
|
248
|
+
materialId: activeDrag.mat.materialID,
|
|
249
|
+
queue: overCol.bin.queueName,
|
|
250
|
+
queuePosition: overCol.idx,
|
|
251
|
+
operator: null,
|
|
252
|
+
});
|
|
253
|
+
reorderQueuedMat({
|
|
254
|
+
queue: overCol.bin.queueName,
|
|
255
|
+
matId: activeDrag.mat.materialID,
|
|
256
|
+
newIdx: overCol.idx,
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
setActiveDrag(null);
|
|
261
|
+
}, onDragCancel: () => setActiveDrag(null), children: [_jsx(SortableContext, { items: curBins.map((b) => b.binId), strategy: horizontalListSortingStrategy, children: _jsx(Box, { component: "main", sx: {
|
|
262
|
+
display: "flex",
|
|
263
|
+
flexWrap: "nowrap",
|
|
264
|
+
backgroundColor: "#F8F8F8",
|
|
265
|
+
minHeight: { xs: "calc(100vh - 64px - 48px)", md: "calc(100vh - 64px)" },
|
|
266
|
+
}, children: curBins.map((matBin) => (_jsx(MaterialBinColumn, { matBin: matBin }, matBin.binId))) }) }), _jsx(DragOverlay, { children: activeDrag?.type === "material" ? (_jsx(DragOverlayInProcMaterial, { mat: activeDrag.mat, hideAvatar: true })) : activeDrag?.type === "column" ? (_jsx(MaterialBinColumn, { matBin: activeDrag.bin, isDragOverlay: true })) : undefined }), _jsx(AllMatDialog, {})] }));
|
|
267
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } 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 } from "react";
|
|
35
|
+
import { last30ChartEndTimes, last30ChartStartTimes, last30WeekdayStartIdx, last30WeekdayStartMinuteOffset, } from "../../data/chart-times";
|
|
36
|
+
import { useAtom, useAtomValue } from "jotai";
|
|
37
|
+
import { Box, Button, Dialog, DialogActions, DialogContent, Divider, IconButton, MenuItem, Radio, RadioGroup, Stack, TextField, Tooltip, Typography, } from "@mui/material";
|
|
38
|
+
import { Edit } from "@mui/icons-material";
|
|
39
|
+
import { addMinutes, startOfToday } from "date-fns";
|
|
40
|
+
function RadioLabel({ label, date }) {
|
|
41
|
+
return (_jsxs(Box, { children: [_jsx(Typography, { children: label }), date ? _jsxs(Typography, { variant: "subtitle2", children: ["(", date.toLocaleString(), ")"] }) : undefined] }));
|
|
42
|
+
}
|
|
43
|
+
function CustomDateLabel({ date, setDate, enabled, }) {
|
|
44
|
+
const last30 = useAtomValue(last30ChartStartTimes("Last30"));
|
|
45
|
+
return (_jsx(TextField, { type: "datetime-local", value: date ? new Date(date.getTime() - date.getTimezoneOffset() * 60000).toISOString().slice(0, 16) : "", onChange: (event) => setDate(new Date(event.target.value)), disabled: !enabled, label: "Custom Date", slotProps: {
|
|
46
|
+
inputLabel: { shrink: true },
|
|
47
|
+
htmlInput: {
|
|
48
|
+
min: new Date(last30.getTime() - last30.getTimezoneOffset() * 60000).toISOString().slice(0, 16),
|
|
49
|
+
},
|
|
50
|
+
} }));
|
|
51
|
+
}
|
|
52
|
+
function RangeStart({ chartAtom }) {
|
|
53
|
+
const [chartRange, setChartRange] = useAtom(chartAtom);
|
|
54
|
+
const dayStart = useAtomValue(last30WeekdayStartMinuteOffset);
|
|
55
|
+
const [customDate, setCustomDate] = useState(chartRange.startType instanceof Date ? chartRange.startType : addMinutes(startOfToday(), dayStart));
|
|
56
|
+
function setTy(type) {
|
|
57
|
+
if (type === "CustomDate") {
|
|
58
|
+
setChartRange({ start: customDate ?? new Date() });
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
setChartRange({ start: type });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function setDate(date) {
|
|
65
|
+
setCustomDate(date);
|
|
66
|
+
setChartRange({ start: date });
|
|
67
|
+
}
|
|
68
|
+
const stOfToday = useAtomValue(last30ChartStartTimes("StartOfToday"));
|
|
69
|
+
const startOfYesterday = useAtomValue(last30ChartStartTimes("StartOfYesterday"));
|
|
70
|
+
const startOfWeek = useAtomValue(last30ChartStartTimes("StartOfWeek"));
|
|
71
|
+
const startOfLastWeek = useAtomValue(last30ChartStartTimes("StartOfLastWeek"));
|
|
72
|
+
const last30 = useAtomValue(last30ChartStartTimes("Last30"));
|
|
73
|
+
return (_jsxs(Box, { children: [_jsx(Typography, { variant: "h6", children: "Range Start" }), _jsx(RadioGroup, { value: chartRange.startType instanceof Date ? "CustomDate" : chartRange.startType, onChange: (event) => setTy(event.target.value), children: _jsxs(Stack, { direction: "column", spacing: 2, children: [_jsxs(Stack, { direction: "row", alignItems: "center", sx: { minHeight: "3em" }, children: [_jsx(Radio, { value: "StartOfToday" }), _jsx(RadioLabel, { label: "Start of Today", date: stOfToday })] }), _jsxs(Stack, { direction: "row", alignItems: "center", sx: { minHeight: "3em" }, children: [_jsx(Radio, { value: "StartOfYesterday" }), _jsx(RadioLabel, { label: "Start of Yesterday", date: startOfYesterday })] }), _jsxs(Stack, { direction: "row", alignItems: "center", sx: { minHeight: "3em" }, children: [_jsx(Radio, { value: "StartOfWeek" }), _jsx(RadioLabel, { label: "Start of This Week", date: startOfWeek })] }), _jsxs(Stack, { direction: "row", alignItems: "center", sx: { minHeight: "3em" }, children: [_jsx(Radio, { value: "StartOfLastWeek" }), _jsx(RadioLabel, { label: "Start of Last Week", date: startOfLastWeek })] }), _jsxs(Stack, { direction: "row", alignItems: "center", sx: { minHeight: "3em" }, children: [_jsx(Radio, { value: "Last30" }), _jsx(RadioLabel, { label: "Last 30 Days", date: last30 })] }), _jsxs(Stack, { direction: "row", alignItems: "center", sx: { minHeight: "3em" }, children: [_jsx(Radio, { value: "CustomDate" }), _jsx(CustomDateLabel, { enabled: chartRange.startType instanceof Date, date: customDate, setDate: setDate })] })] }) })] }));
|
|
74
|
+
}
|
|
75
|
+
function RangeEnd({ chartAtom }) {
|
|
76
|
+
const [chartRange, setChartRange] = useAtom(chartAtom);
|
|
77
|
+
const dayStart = useAtomValue(last30WeekdayStartMinuteOffset);
|
|
78
|
+
const [customDate, setCustomDate] = useState(chartRange.endType instanceof Date ? chartRange.endType : addMinutes(startOfToday(), dayStart));
|
|
79
|
+
function setTy(type) {
|
|
80
|
+
if (type === "CustomDate") {
|
|
81
|
+
setChartRange({ end: customDate ?? new Date() });
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
setChartRange({ end: type });
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function setDate(date) {
|
|
88
|
+
setCustomDate(date);
|
|
89
|
+
setChartRange({ end: date });
|
|
90
|
+
}
|
|
91
|
+
const endOfYesterday = useAtomValue(last30ChartEndTimes("EndOfYesterday"));
|
|
92
|
+
const endOfLastWeek = useAtomValue(last30ChartEndTimes("EndOfLastWeek"));
|
|
93
|
+
return (_jsxs(Box, { children: [_jsx(Typography, { variant: "h6", children: "Range End" }), _jsx(RadioGroup, { value: chartRange.endType instanceof Date ? "CustomDate" : chartRange.endType, onChange: (event) => setTy(event.target.value), children: _jsxs(Stack, { direction: "column", spacing: 2, children: [_jsxs(Stack, { direction: "row", alignItems: "center", sx: { minHeight: "3em" }, children: [_jsx(Radio, { value: "Now" }), _jsx(Typography, { children: "Now" })] }), _jsxs(Stack, { direction: "row", alignItems: "center", sx: { minHeight: "3em" }, children: [_jsx(Radio, { value: "EndOfYesterday" }), _jsx(RadioLabel, { label: "End of Yesterday", date: endOfYesterday })] }), _jsx(Box, { sx: { height: "3em" } }), _jsxs(Stack, { direction: "row", alignItems: "center", sx: { minHeight: "3em" }, children: [_jsx(Radio, { value: "EndOfLastWeek" }), _jsx(RadioLabel, { label: "End of Last Week", date: endOfLastWeek })] }), _jsx(Box, { sx: { height: "3em" } }), _jsxs(Stack, { direction: "row", alignItems: "center", sx: { minHeight: "3em" }, children: [_jsx(Radio, { value: "CustomDate" }), _jsx(CustomDateLabel, { enabled: chartRange.endType instanceof Date, date: customDate, setDate: setDate })] })] }) })] }));
|
|
94
|
+
}
|
|
95
|
+
function minutesToTimespan(m) {
|
|
96
|
+
const h = Math.floor(m / 60);
|
|
97
|
+
const min = m % 60;
|
|
98
|
+
return `${h.toString().padStart(2, "0")}:${min.toString().padStart(2, "0")}`;
|
|
99
|
+
}
|
|
100
|
+
function RangeDialog({ chartAtom, open, setOpen, }) {
|
|
101
|
+
const [weekdayStart, setWeekdayStart] = useAtom(last30WeekdayStartIdx);
|
|
102
|
+
const [weekdayStartMinuteOffset, setWeekdayStartMinuteOffset] = useAtom(last30WeekdayStartMinuteOffset);
|
|
103
|
+
return (_jsxs(Dialog, { open: open, onClose: () => setOpen(false), maxWidth: "md", children: [_jsx(DialogContent, { children: _jsxs(Stack, { direction: "column", spacing: 2, divider: _jsx(Divider, { orientation: "horizontal", flexItem: true }), children: [_jsxs(Stack, { direction: "row", spacing: 2, divider: _jsx(Divider, { orientation: "vertical", flexItem: true }), children: [_jsx(RangeStart, { chartAtom: chartAtom }), _jsx(RangeEnd, { chartAtom: chartAtom })] }), _jsxs(Stack, { direction: "row", justifyContent: "space-around", children: [_jsxs(TextField, { select: true, label: "First Day Of Week", sx: { minWidth: "10em" }, value: weekdayStart, onChange: (e) => setWeekdayStart(parseInt(e.target.value)), children: [_jsx(MenuItem, { value: 0, children: "Sunday" }), _jsx(MenuItem, { value: 1, children: "Monday" }), _jsx(MenuItem, { value: 2, children: "Tuesday" }), _jsx(MenuItem, { value: 3, children: "Wednesday" }), _jsx(MenuItem, { value: 4, children: "Thursday" }), _jsx(MenuItem, { value: 5, children: "Friday" }), _jsx(MenuItem, { value: 6, children: "Saturday" })] }), _jsx(TextField, { type: "time", label: "Day Start Time", sx: { minWidth: "10em" }, value: minutesToTimespan(weekdayStartMinuteOffset), onChange: (e) => {
|
|
104
|
+
const val = e.target.value;
|
|
105
|
+
if (val === "") {
|
|
106
|
+
setWeekdayStartMinuteOffset(0);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
const [h, m] = val.split(":").map(Number);
|
|
110
|
+
setWeekdayStartMinuteOffset(h * 60 + m);
|
|
111
|
+
}
|
|
112
|
+
} })] })] }) }), _jsx(DialogActions, { children: _jsx(Button, { onClick: () => setOpen(false), children: "Close" }) })] }));
|
|
113
|
+
}
|
|
114
|
+
function formatStart(ty, d) {
|
|
115
|
+
if (ty instanceof Date) {
|
|
116
|
+
return ty.toLocaleString();
|
|
117
|
+
}
|
|
118
|
+
switch (ty) {
|
|
119
|
+
case "StartOfToday":
|
|
120
|
+
return `Start of Today${d ? ` (${d.toLocaleString()})` : ""}`;
|
|
121
|
+
case "StartOfYesterday":
|
|
122
|
+
return `Start of Yesterday${d ? ` (${d.toLocaleString()})` : ""}`;
|
|
123
|
+
case "StartOfWeek":
|
|
124
|
+
return `Start of This Week${d ? ` (${d.toLocaleString()})` : ""}`;
|
|
125
|
+
case "StartOfLastWeek":
|
|
126
|
+
return `Start of Last Week${d ? ` (${d.toLocaleString()})` : ""}`;
|
|
127
|
+
case "Last30":
|
|
128
|
+
return `Last 30 Days${d ? ` (${d.toLocaleString()})` : ""}`;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function formatEnd(ty, d) {
|
|
132
|
+
if (ty instanceof Date) {
|
|
133
|
+
return ty.toLocaleString();
|
|
134
|
+
}
|
|
135
|
+
switch (ty) {
|
|
136
|
+
case "Now":
|
|
137
|
+
return "Now";
|
|
138
|
+
case "EndOfYesterday":
|
|
139
|
+
return `End of Yesterday${d ? ` (${d.toLocaleString()})` : ""}`;
|
|
140
|
+
case "EndOfLastWeek":
|
|
141
|
+
return `End of Last Week${d ? ` (${d.toLocaleString()})` : ""}`;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
export const Last30ChartRangeToolbar = memo(function Last30ChartRangeToolbar({ chartAtom, }) {
|
|
145
|
+
const chartRange = useAtomValue(chartAtom);
|
|
146
|
+
const [dialogOpen, setDialogOpen] = useState(false);
|
|
147
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [_jsxs(Typography, { variant: "body2", color: "textSecondary", children: ["Range: ", formatStart(chartRange.startType, chartRange.startDate), " -", " ", formatEnd(chartRange.endType, chartRange.endDate)] }), _jsx(Tooltip, { title: "Edit Range", children: _jsx(IconButton, { onClick: () => setDialogOpen(true), children: _jsx(Edit, {}) }) })] }), _jsx(RangeDialog, { open: dialogOpen, setOpen: setDialogOpen, chartAtom: chartAtom })] }));
|
|
148
|
+
});
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* Copyright (c) 2024, 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, useMemo, useState } from "react";
|
|
35
|
+
import { addDays, startOfToday } from "date-fns";
|
|
36
|
+
import { Box, IconButton, Stack, Table, TableBody, TableCell, TableHead, TableRow, TableSortLabel, Tooltip, Typography, } from "@mui/material";
|
|
37
|
+
import { Button } from "@mui/material";
|
|
38
|
+
import { MaterialDialog, PartIdenticon } from "../station-monitor/Material.js";
|
|
39
|
+
import { SelectWorkorderDialog, selectWorkorderDialogOpen } from "../station-monitor/SelectWorkorder.js";
|
|
40
|
+
import { materialDialogOpen, materialInDialogInfo, useCompleteCloseout, } from "../../cell-status/material-details.js";
|
|
41
|
+
import { last30MaterialSummary, } from "../../cell-status/material-summary.js";
|
|
42
|
+
import { useSetTitle } from "../routes.js";
|
|
43
|
+
import { useAtomValue, useSetAtom } from "jotai";
|
|
44
|
+
import { LazySeq } from "@seedtactics/immutable-collections";
|
|
45
|
+
import { Check, ErrorOutline, MoreHoriz, SkipNext, SkipPrevious } from "@mui/icons-material";
|
|
46
|
+
function CloseoutDialogButtons() {
|
|
47
|
+
const setWorkorderDialogOpen = useSetAtom(selectWorkorderDialogOpen);
|
|
48
|
+
const mat = useAtomValue(materialInDialogInfo);
|
|
49
|
+
const [complete, isCompleting] = useCompleteCloseout();
|
|
50
|
+
const setToShow = useSetAtom(materialDialogOpen);
|
|
51
|
+
if (mat === null || mat.materialID < 0) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
function closeout(failed) {
|
|
55
|
+
if (mat === null)
|
|
56
|
+
return;
|
|
57
|
+
complete({
|
|
58
|
+
mat,
|
|
59
|
+
operator: "Manager",
|
|
60
|
+
failed,
|
|
61
|
+
});
|
|
62
|
+
setToShow(null);
|
|
63
|
+
}
|
|
64
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { color: "primary", disabled: isCompleting, onClick: () => closeout(true), children: "Fail CloseOut" }), _jsx(Button, { color: "primary", disabled: isCompleting, onClick: () => closeout(false), children: "Pass CloseOut" }), _jsx(Button, { color: "primary", onClick: () => setWorkorderDialogOpen(true), children: "Change Workorder" })] }));
|
|
65
|
+
}
|
|
66
|
+
const CloseoutMaterialDialog = memo(function CloseoutDialog() {
|
|
67
|
+
return _jsx(MaterialDialog, { buttons: _jsx(CloseoutDialogButtons, {}) });
|
|
68
|
+
});
|
|
69
|
+
const fulldayFormat = new Intl.DateTimeFormat(undefined, {
|
|
70
|
+
weekday: "long",
|
|
71
|
+
month: "long",
|
|
72
|
+
day: "numeric",
|
|
73
|
+
year: "numeric",
|
|
74
|
+
});
|
|
75
|
+
function NavigateDay({ day, setDay, }) {
|
|
76
|
+
const today = startOfToday();
|
|
77
|
+
return (_jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [_jsx(Tooltip, { title: "Previous Day", children: _jsx("div", { children: _jsx(IconButton, { disabled: day <= addDays(today, -28), onClick: () => setDay((d) => addDays(d, -1)), children: _jsx(SkipPrevious, {}) }) }) }), _jsx(Typography, { sx: { minWidth: "14em", textAlign: "center" }, children: fulldayFormat.format(day) }), _jsx(Tooltip, { title: "Next Day", children: _jsx("div", { children: _jsx(IconButton, { disabled: day >= today, onClick: () => setDay((d) => addDays(d, 1)), children: _jsx(SkipNext, {}) }) }) })] }));
|
|
78
|
+
}
|
|
79
|
+
var SortColumn;
|
|
80
|
+
(function (SortColumn) {
|
|
81
|
+
SortColumn[SortColumn["CompletedTime"] = 0] = "CompletedTime";
|
|
82
|
+
SortColumn[SortColumn["Serial"] = 1] = "Serial";
|
|
83
|
+
SortColumn[SortColumn["Part"] = 2] = "Part";
|
|
84
|
+
SortColumn[SortColumn["Workorder"] = 3] = "Workorder";
|
|
85
|
+
SortColumn[SortColumn["Closeout"] = 4] = "Closeout";
|
|
86
|
+
SortColumn[SortColumn["CloseoutTime"] = 5] = "CloseoutTime";
|
|
87
|
+
})(SortColumn || (SortColumn = {}));
|
|
88
|
+
function sortMats(mats, sortBy, order) {
|
|
89
|
+
let sortCol;
|
|
90
|
+
switch (sortBy) {
|
|
91
|
+
case SortColumn.CompletedTime:
|
|
92
|
+
sortCol = (j) => j.last_unload_time ?? null;
|
|
93
|
+
break;
|
|
94
|
+
case SortColumn.Part:
|
|
95
|
+
sortCol = (j) => j.partName;
|
|
96
|
+
break;
|
|
97
|
+
case SortColumn.Serial:
|
|
98
|
+
sortCol = (j) => j.serial ?? null;
|
|
99
|
+
break;
|
|
100
|
+
case SortColumn.Workorder:
|
|
101
|
+
sortCol = (j) => j.workorderId ?? null;
|
|
102
|
+
break;
|
|
103
|
+
case SortColumn.Closeout:
|
|
104
|
+
sortCol = (j) => j.closeout_failed ?? null;
|
|
105
|
+
break;
|
|
106
|
+
case SortColumn.CloseoutTime:
|
|
107
|
+
sortCol = (j) => j.closeout_completed ?? null;
|
|
108
|
+
}
|
|
109
|
+
return LazySeq.of(mats).toSortedArray(order === "asc" ? { asc: sortCol } : { desc: sortCol }, {
|
|
110
|
+
asc: (j) => j.last_unload_time ?? null,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
function CloseoutHeader({ sortBy, setSortBy, sortOrder, setSortOrder, }) {
|
|
114
|
+
function toggleSort(col) {
|
|
115
|
+
if (col === sortBy) {
|
|
116
|
+
setSortOrder(sortOrder === "asc" ? "desc" : "asc");
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
setSortBy(col);
|
|
120
|
+
setSortOrder("asc");
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return (_jsxs(TableRow, { children: [_jsx(TableCell, { sortDirection: sortBy === SortColumn.CompletedTime ? sortOrder : false, children: _jsx(TableSortLabel, { active: sortBy === SortColumn.CompletedTime, direction: sortOrder, onClick: () => toggleSort(SortColumn.CompletedTime), children: "Completed Time" }) }), _jsx(TableCell, { sortDirection: sortBy === SortColumn.Serial ? sortOrder : false, children: _jsx(TableSortLabel, { active: sortBy === SortColumn.Serial, direction: sortOrder, onClick: () => toggleSort(SortColumn.Serial), children: "Serial" }) }), _jsx(TableCell, { sortDirection: sortBy === SortColumn.Part ? sortOrder : false, children: _jsx(TableSortLabel, { active: sortBy === SortColumn.Part, direction: sortOrder, onClick: () => toggleSort(SortColumn.Part), children: "Part" }) }), _jsx(TableCell, { sortDirection: sortBy === SortColumn.Workorder ? sortOrder : false, children: _jsx(TableSortLabel, { active: sortBy === SortColumn.Workorder, direction: sortOrder, onClick: () => toggleSort(SortColumn.Workorder), children: "Workorder" }) }), _jsx(TableCell, { sortDirection: sortBy === SortColumn.Closeout ? sortOrder : false, children: _jsx(TableSortLabel, { active: sortBy === SortColumn.Closeout, direction: sortOrder, onClick: () => toggleSort(SortColumn.Closeout), children: "Closeout" }) }), _jsx(TableCell, { sortDirection: sortBy === SortColumn.CloseoutTime ? sortOrder : false, children: _jsx(TableSortLabel, { active: sortBy === SortColumn.CloseoutTime, direction: sortOrder, onClick: () => toggleSort(SortColumn.CloseoutTime), children: "Closeout Time" }) }), _jsx(TableCell, {})] }));
|
|
124
|
+
}
|
|
125
|
+
const timeOnlyFormat = new Intl.DateTimeFormat(undefined, {
|
|
126
|
+
hour: "2-digit",
|
|
127
|
+
minute: "numeric",
|
|
128
|
+
second: "numeric",
|
|
129
|
+
});
|
|
130
|
+
const noSecondsFormat = new Intl.DateTimeFormat(undefined, {
|
|
131
|
+
year: "numeric",
|
|
132
|
+
month: "numeric",
|
|
133
|
+
day: "numeric",
|
|
134
|
+
hour: "numeric",
|
|
135
|
+
minute: "numeric",
|
|
136
|
+
});
|
|
137
|
+
const CloseoutRow = memo(function CloseoutRow({ mat }) {
|
|
138
|
+
const setMatToShow = useSetAtom(materialDialogOpen);
|
|
139
|
+
return (_jsxs(TableRow, { children: [_jsx(TableCell, { children: mat.last_unload_time ? timeOnlyFormat.format(mat.last_unload_time) : "" }), _jsx(TableCell, { children: mat.serial }), _jsx(TableCell, { children: _jsxs(Stack, { direction: "row", spacing: "2", alignItems: "center", children: [_jsx(PartIdenticon, { part: mat.partName, size: 25 }), _jsx(Typography, { variant: "body2", children: mat.partName })] }) }), _jsx(TableCell, { children: mat.workorderId }), _jsx(TableCell, { children: mat.closeout_completed === null || mat.closeout_completed === undefined ? ("") : mat.closeout_failed ? (_jsx(ErrorOutline, { fontSize: "inherit" })) : (_jsx(Check, { fontSize: "inherit" })) }), _jsx(TableCell, { children: mat.closeout_completed ? noSecondsFormat.format(mat.closeout_completed) : "" }), _jsx(TableCell, { padding: "checkbox", children: mat.serial !== null && mat.serial !== "" ? (_jsx(IconButton, { onClick: () => {
|
|
140
|
+
if (!mat.serial)
|
|
141
|
+
return;
|
|
142
|
+
setMatToShow({
|
|
143
|
+
type: "ManuallyEnteredSerial",
|
|
144
|
+
serial: mat.serial,
|
|
145
|
+
});
|
|
146
|
+
}, size: "large", children: _jsx(MoreHoriz, { fontSize: "inherit" }) })) : undefined })] }));
|
|
147
|
+
});
|
|
148
|
+
function CloseoutTable({ day }) {
|
|
149
|
+
const matSummary = useAtomValue(last30MaterialSummary);
|
|
150
|
+
const material = useMemo(() => {
|
|
151
|
+
const endT = addDays(day, 1);
|
|
152
|
+
const uncompleted = [];
|
|
153
|
+
for (const m of matSummary.matsById.values()) {
|
|
154
|
+
if (m.completed_last_proc_machining === true &&
|
|
155
|
+
m.last_unload_time &&
|
|
156
|
+
m.last_unload_time >= day &&
|
|
157
|
+
m.last_unload_time < endT) {
|
|
158
|
+
uncompleted.push(m);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return uncompleted;
|
|
162
|
+
}, [matSummary, day]);
|
|
163
|
+
const [sortBy, setSortBy] = useState(SortColumn.CompletedTime);
|
|
164
|
+
const [sortOrder, setSortOrder] = useState("asc");
|
|
165
|
+
const sortedMats = useMemo(() => sortMats(material, sortBy, sortOrder), [material, sortBy, sortOrder]);
|
|
166
|
+
return (_jsxs(Table, { stickyHeader: true, children: [_jsx(TableHead, { children: _jsx(CloseoutHeader, { sortBy: sortBy, setSortBy: setSortBy, sortOrder: sortOrder, setSortOrder: setSortOrder }) }), _jsx(TableBody, { children: sortedMats.map((mat) => (_jsx(CloseoutRow, { mat: mat }, mat.materialID))) })] }));
|
|
167
|
+
}
|
|
168
|
+
export function CloseoutReport() {
|
|
169
|
+
useSetTitle("Close Out");
|
|
170
|
+
const [day, setDay] = useState(startOfToday());
|
|
171
|
+
return (_jsxs(Box, { padding: "24px", children: [_jsx(Box, { component: "nav", display: "flex", justifyContent: "center", children: _jsx(NavigateDay, { day: day, setDay: setDay }) }), _jsx("main", { children: _jsx(CloseoutTable, { day: day }) }), _jsx(SelectWorkorderDialog, {}), _jsx(CloseoutMaterialDialog, {})] }));
|
|
172
|
+
}
|